views:

47

answers:

2

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?

+1  A: 

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.

Lieven
+1  A: 

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

Here follow this tutorial link

VoodooChild