Groups | Blog | Home
all groups > sql server programming > february 2007 >

sql server programming : runing sql script through command line


Afshar Mohebbi
2/23/2007 10:53:59 PM
Dear SQL Friends,

my question may be asked repeatedly before, but i couldn't find a
straight answer for it.

I simply want to run some scripts that creates tables and stored
procedures through some command line tool so I can run them
automatically.

I am using SQL Server 2005 and SQL Server EXPRESS.

thanks in advance
Afshar
Tibor Karaszi
2/24/2007 12:00:00 AM
Seems like a job for SQLCMD.EXE.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


[quoted text, click to view]
Erland Sommarskog
2/24/2007 4:26:22 PM
Afshar Mohebbi (afshar.mohebbi@gmail.com) writes:
[quoted text, click to view]

As an addition to Tibor's post, be sure to SQLCMD with the -I option
to turn on the QUOTED_IDENTIFIER setting which is required for some
functionality in SQL Server.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Afshar Mohebbi
2/25/2007 3:12:47 AM
Thanks!!!
It worked just in the way I wanted!!


Cheers
Afshar
AddThis Social Bookmark Button