Scripting with Sql Server 2005

Easiest way to go is to get sqlcmd from here, you'll have to get :

  • sqlncli.msi : Microsoft SQL Server Native Client
  • SQLServer2005_SQLCMD.msi

There is many good tutorials around but to be quick the standard command line is

sqlcmd -SServer -UUser -PPassword -dDatabase -iMyFile.sql

You can also add -b to error out in case of SQL error.


Published 28th May 2011 // #sqlserver #tips




comments powered by Disqus