-
How to Run sql script file (External) file
hi to all,
I want to run external script file (c:\test.sql) from the MSSQL command window. Is it possible in MSSQL 2005 ?.
Thanks in advance.
-
You can double click the file, that loads the file to ssms query windows, then execute it. Or just copy contents in the file and paste them in ssms query windows then execute.
-
Thanks for reply.
I already wrote some script lines in ssms. In between that script i want to execute the external file any command is there for invoking the external script file.
Thanks in advance guy.
-
then call it with sqlcmd in xp_cmdshell like:
master..xp_cmdshell 'sqlcmd ...'
Check syntax in books online.
-
If you want to run it outside of SSMS, you can use sqlcmd.exe or osql.exe
-
Remember to enable xp_cmdshell using the surface area configuration tool if you're planning on using it.
-
You can enable it with sp_configure.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|