Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 BAtch File using SQLCMD

Author  Topic 

pradeep_iete
Yak Posting Veteran

84 Posts

Posted - 2010-04-23 : 01:29:51

HI ALl

I want to make batch file using sqlcmd where in
i have to truncate three table every time it runs.
I will have three inputs

EntityCOde (This will be used as name of database with prefix QDB)
Instance Name (TO execute at particular instance of sql server)
UserName
Passward

Please guide me.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-23 : 12:29:23
sqlcmd -Ssomeserver -Usomeuser -Psomepassword -iC:\SomeFile.txt -oC:\SomeOutputFile.txt -dsomedatabase

Put your commands inside SomeFile.txt

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -