100 likes | 269 Views
Scripting and automation with SQLCMD . Haidong “Alex” Ji http://www.HaidongJi.com . About Me. http://www.HaidongJi.com MCSD, MCDBA Co-author of Professional SQL Server 2005 Integration Services from Wrox
E N D
Scripting and automation with SQLCMD Haidong “Alex” Ji http://www.HaidongJi.com
About Me • http://www.HaidongJi.com • MCSD, MCDBA • Co-author of Professional SQL Server 2005 Integration Services from Wrox • Regular columnist for SqlServerCentral.comhttp://www.sqlservercentral.com/columnists/hji/ • Specialize in Sql Server. Also work with Oracle and MySql on Solaris and Linux
Agenda • sqlcmd, osql, and isql comparison • Batch and Interactive mode • sqlcmd customization • Variables for powerful scripting • sqlcmd in Management Studio
sqlcmd, osql, and isql • osql there, isql gone • osql on its way out, maybe Sql Server 2010;) • Switches are very similar. Switches are case-sensitive!! • Same commenting style • Demo • Look at the switches by doing sqlcmd /? and osql /?
Batch and Interactive mode • Batch: use -i for input script file • Interactive • Demo • Pubs batch • Interactive Pubs
sqlcmd customization • Change default editor • Initialization script • Demo
Variables for powerful scripting • Backup and restore scenario and scripts • Demo
sqlcmd in Management Studio • Good place for editing • Some sqlcmd commands cannot be used
Additional Resources • BOL • Sqlservercentral.com • http://www.HaidongJi.com/download I will post the slides and scripts there for download.
Thank you! Thank you for attending this session and the 2006 PASS European Conference in Barcelona, Spain. Please help us improve the quality of our conference by completing your session evaluation form. Completed evaluation forms should be submitted to the room monitor as you exit or to staff at the registration desk.