tags:

views:

27

answers:

1

When get a .sql file, how do you execute it? Double click to open it and press F5? Is there any other way to execute it and also able to see the execution result. Thanks.

+2  A: 

run the OSQL or SqlCmd tools

for example

osql -D db_name -S server_name -U username -P password -i sqlfile
or
sqlcmd -D db_name -S server_name -U username -P password -i sqlfile

or you can use -E instead of user and password to do integrated security

Preet Sangha