开发者

Run sql script from console and not from query analyzer in SQL server

开发者_JS百科

I have written an sql script for updating a database that runs in SQL server 2005.

I want to make those changes to the production DB server but I dont want to run the query from the query analyzer. Is there a way to run the sql script from a console?


create a batch file that points to the script or scripts that you created and run that batch file.

Here follow this tutorial link


You can use sqlcmd. It gets installed together with installing the Query Analyzer.

The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt, in Query Editor in SQLCMD mode, in a Windows script file or in an operating system (Cmd.exe) job step of a SQL Server Agent job. This utility uses OLE DB to execute Transact-SQL batches.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜