MSSQLCity.Com - All about MS SQL
     
About Us  
SSWUG Articles  
Articles  
FAQ  
Administration  
Backup/Restore  
Connectivity  
Development  
General  
Installation  
OLAP  
Replication  
Transfer/move  
Trouble  
SQL 6.5  
Scripts  
Tips  
Test Exams  
Advertise  
Download  
History  
Search  
Traffic  
Related Links  
     
Your button logo
Add to Favorites
 
     
 


How do I run SQL script located on the disk file, using Transact-SQL?

Answer:

You can use osql or isql utility to run SQL script located on the disk file. This is the example to run SQL script located in the C:\SQLScript.sql file:

EXEC master..xp_cmdshell 'osql -S Servername -U sa -P -ic:\SQLScript.sql'

See SQL Server Books Online for more information about osql or isql utility and about xp_cmdshell extended stored procedure.


 

 
Visit The SQL Server Worldwide User's Group for all the latest news and information about SQL Server, Oracle, DB2 and XML for developers and administrators.

(c) 1997, 2005 Bits on the Wire, Inc