?
Solved

Changing scripts from using isql to sqlcmd - global replace?

Posted on 2013-10-29
6
Medium Priority
?
993 Views
Last Modified: 2013-11-04
I'm upgrading a sever that runs SQL server batch jobs.  (The databases are actually on a different server, but SQL server is installed on this "Scheduling" server.)   The server I'm upgrading is SQL Server 2000 and on it's replacement server I will be installing SQL Server 2008 R2 (to be like the servers where the DBs reside).

The batch jobs on the server currently run scripts like this:

isql -Usa -Ppw -dDBname -iD:\SQL\OrderHist.sql -SserverName

We also run BCPs in them that look like this:

bcp DBname..TableName in H:\download\txt\file.txt /fD:\bcp\fmt\file.fmt /Usa /Ppw /SserverName /r\n /m100

Should I be able to do a search and replace on these bat files and replace all the "isql" with "sqlcmd" and the bat jobs run just fine on the new server?

What about the BCP - will the same command format for it work on 2008?

thanks
0
Comment
Question by:sqdperu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 8

Expert Comment

by:virtuadept
ID: 39608985
As another option just put a copy of SQLCMD.exe as ISQL.exe in the path.

then you don't have to change all your scripts.

BCP shouldn't need to change.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 39609821
Obviously you will also need to change

<<
The batch jobs on the server currently run scripts like this:

isql -Usa -Ppw -dDBname -iD:\SQL\OrderHist.sql -SserverName
>>

like

sqlcmd -Usa -Ppw -dDBname -iD:\SQL\OrderHist.sql -SserverName
0
 

Author Comment

by:sqdperu
ID: 39611336
"Obviously you will also need to change ... "

That's my question.  Can I just change the "isql" to "sqlcmd" in all my jobs and the parameters that follow that worked with "isql" will work just fine using "sqlcmd"?

Is "sqlcmd" completely backwards compatible with how the parameters worked with "isql"?

I'm looking for comfirmation from someone who has actually tried this and know that it works.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 40

Accepted Solution

by:
lcohan earned 1200 total points
ID: 39612197
"I'm looking for comfirmation from someone who has actually tried this and know that it works."


I work with SQL server since its 3.5 version to date - 2012 and for ISQL or OSQL vs. SQLCMD the only difference that I'm aware of is that SQLSMD returns/displays more decimals on float columns as per article below.

http://social.msdn.microsoft.com/Forums/en-US/1f30da7e-f1b0-48cd-9197-98f78f30face/isql-to-sqlcmd-conversion-format-issues

Other than that you can compare the commands at Microsoft links below:

ISQL: http://technet.microsoft.com/en-us/library/aa214007(v=sql.80).aspx
SQLCMD: http://technet.microsoft.com/en-us/library/ms162773(v=sql.100).aspx
0
 
LVL 8

Assisted Solution

by:virtuadept
virtuadept earned 800 total points
ID: 39612268
There is no way for us to guarantee that the SQL running with a different version of SQL server is going to work the same way as it did on the prior version of SQL server. But the command line parameters are the same format for ISQL or OSQL or SQLCMD.
0
 

Author Comment

by:sqdperu
ID: 39621369
"There is no way for us to guarantee that the SQL running with a different version of SQL server is going to work the same way as it did on the prior version of SQL server. But the command line parameters are the same format for ISQL or OSQL or SQLCMD. "

I plan to test all the jobs on a test server.  I was just looking for a starting point and it sounds like a global change and test would be it.  thanks.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question