Category: SQLServer

  • sqlcmd presentation on 01/12/2006

    I did a presentation on sqlcmd at the Chicago Sql Server User Group meeting yesterday at Microsoft’s downtown Chicago office. Overall, I think it went pretty well. For participants, thanks for coming and your great questions. As I mentioned earlier, the slides and scripts used can be downloaded here. Let me know if you have […]

  • Sql Server presentation on 01/12/2005

    As posted here, my presentation last month at Chicago Sql Server User Group was cancelled due to some technical issues. So I will present again in our next Chicago Sql Server User Group meeting on Thursday, 01/12/2005, at Microsoft’s downtown Chicago office on Wacker Drive. The session will start around 5:30pm. Free pizza and soda […]

  • Rename sa

    With SQL Server 2005, you can rename your logins, including sa. To me, this is a HUGE security enhancement. For mixed security environments, many Sql Server attacks take advantage of the sa account, either by brute-force or dictionary attacks. I highly recommend you to rename sa to something that is discreet to minimize attack surface […]

  • Find out date and time of the last database restore

    Sometimes you may have the need to find out the date and time a particular database was last restored. Here is a simple way to do it. It should work in both SQL Server 2000 and SQL Server 2005: use msdb select max(restore_date) from restorehistory where destination_database_name = ‘MyDatabaseName’

  • Set sqlcmd initialization file

    By now you probably can tell that I am a big fan of sqlcmd;) Here is one more nugget on sqlcmd that I can throw at you: You can set a variable so that sqlcmd would run a query whenever you launch it from the command line interactively. For example, you can let it run […]