Reputation: 35
I need to exec this sql query on my Windows SQL Server 2005, can i do this with a batch script?
The sql query
UPDATE VI_CURR_INFO SET
ends_days = '2005',
check_code = '1',
memb_name = '123132',
memb_guid = '1',
sno__numb = '1',
Bill_Section = '6',
Bill_Value = '3',
Bill_Hour = '6',
Surplus_Point = '6',
Increase_Days = '0'
The database name is "test1". How to perform a batch script to do that?
Thanks in advance.
Upvotes: 2
Views: 1740
Reputation:
Create a script file that looks like this:
use test1
go
UPDATE VI_CURR_INFO
SET ends_days = '2005',
check_code = '1',
memb_name = '123132',
memb_guid = '1',
sno__numb = '1',
Bill_Section = '6',
Bill_Value = '3',
Bill_Hour = '6',
Surplus_Point = '6',
Increase_Days = '0'
Save this as a script file (Script1.sql
for example). And then use SQLCMD to run the script against an instance:
sqlcmd -S YourServerName[\YourInstanceName] -i C:\YourScriptFileDir\Script1.sql
Upvotes: 1