Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

Import stored procedures in .sql file using command line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lurchot - 31 Jul 2008 09:43 GMT
Dear all,

I have a .sql file which contains several stored procedures used for report
generation, and I know how to insert/import it into sql server database by
Management Studio.

My question is how can I do the same action using command line syntax, like
......
backup database ABC to disk='........'
......

because I plan to use DOS batch file to run it.

Thanks.

lurc
Uri Dimant - 31 Jul 2008 10:08 GMT
Hi
EXEC master..xp_cmdshell 'osql.exe -S SERVER -U sa -P pass -dNorthwind -i
"D:\ORD1.sql"'

> Dear all,
>
[quoted text clipped - 13 lines]
>
> lurc
vinu - 31 Jul 2008 10:48 GMT
hi

to add to Uri's post if you using SQL 2005, then use sqlcmd.exe, see bol for
more info

Signature

vinu
http://oneplace4sql.blogspot.com/

> Hi
> EXEC master..xp_cmdshell 'osql.exe -S SERVER -U sa -P pass -dNorthwind -i
[quoted text clipped - 17 lines]
>>
>> lurc
amish - 31 Jul 2008 15:24 GMT
> Dear all,
>
[quoted text clipped - 12 lines]
>
> lurc

If you are using SQL Server 2005 you can use SQLCMD.

Amish Shah
http://shahamishm.blogspot.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.