Solved

Changing scripts from using isql to sqlcmd - global replace?

Posted on 2013-10-29
6
914 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
  • 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 39

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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 39

Accepted Solution

by:
lcohan earned 300 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 200 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert in derived column 7 29
SQL Server 2012 r2 - Sum totals 2 25
Find results from sql within a time span 11 30
New to SSRS, extremely slow running report. 8 20
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.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

770 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