Home All Groups Group Topic Archive Search About

Script works in SQLCMD, need to run it in OSQL or similar

Author
31 Oct 2007 12:10 PM
PhilHibbs
I have a set of extract scripts that I can run using SQLCMD, but I
need to run them on a SQL Server 7 database server. SQLS7 doesn't have
SQLCMD, but it does have OSQL. This leaves me with some challenges:

1. OSQL doesn't have the -W parameter to trim trailing spaces
2. OSQL is wrapping the lines of output
3. OSQL puts >1 >2 >3 >4 etc. at the top of the output file

Any suggestions how I can overcome these problems?

Phil.

Author
31 Oct 2007 1:10 PM
Andrew J. Kelly
I have never tried this but I assume SQLCmd talks to 7.0 ok.  Do you have a
2005 server that you can run SqlCmd on and just point it to the 7.0 server?

--
Andrew J. Kelly    SQL MVP
Solid Quality Mentors


Show quote
"PhilHibbs" <sna***@gmail.com> wrote in message
news:1193832636.665137.143620@k79g2000hse.googlegroups.com...
>I have a set of extract scripts that I can run using SQLCMD, but I
> need to run them on a SQL Server 7 database server. SQLS7 doesn't have
> SQLCMD, but it does have OSQL. This leaves me with some challenges:
>
> 1. OSQL doesn't have the -W parameter to trim trailing spaces
> 2. OSQL is wrapping the lines of output
> 3. OSQL puts >1 >2 >3 >4 etc. at the top of the output file
>
> Any suggestions how I can overcome these problems?
>
> Phil.
>
Author
31 Oct 2007 1:16 PM
Chris.Cheney
PhilHibbs <sna***@gmail.com> wrote in news:1193832636.665137.143620
@k79g2000hse.googlegroups.com:

> I have a set of extract scripts that I can run using SQLCMD, but I
> need to run them on a SQL Server 7 database server. SQLS7 doesn't have
> SQLCMD, but it does have OSQL. This leaves me with some challenges:
>
> 1. OSQL doesn't have the -W parameter to trim trailing spaces
> 2. OSQL is wrapping the lines of output
> 3. OSQL puts >1 >2 >3 >4 etc. at the top of the output file
>
> Any suggestions how I can overcome these problems?
>
> Phil.
>
>

From http://www.microsoft.com/downloads/details.aspx?FamilyID=50B97994-
8453-4998-8226-FA42EC403D17&displaylang=en

"The SQLCMD utility allows users to connect, send Transact-SQL batches, and
output rowset information from SQL Server 7.0, SQL Server 2000, and SQL
Server 2005 instances. SQLCMD is a replacement for ISQL and OSQL, but can
coexist with installations that have ISQL or OSQL installed."

although I haven't myself tried installing it on a machine that only has
SQL Server 7.
Author
31 Oct 2007 3:50 PM
PhilHibbs
On 31 Oct, 13:16, "Chris.Cheney" <Chris.CheneyXXNOSPA***@tesco.net>
wrote:
> "The SQLCMD utility allows users to connect, send Transact-SQL batches, and
> output rowset information from SQL Server 7.0, SQL Server 2000, and SQL
> Server 2005 instances. SQLCMD is a replacement for ISQL and OSQL, but can
> coexist with installations that have ISQL or OSQL installed."

Not an option, unfortunately, can't install anything at the supplier's
site.

Phil.
Author
31 Oct 2007 2:34 PM
Roy Harvey (SQL Server MVP)
On Wed, 31 Oct 2007 12:10:36 -0000, PhilHibbs <sna***@gmail.com>
wrote:

>I have a set of extract scripts that I can run using SQLCMD, but I
>need to run them on a SQL Server 7 database server. SQLS7 doesn't have
>SQLCMD, but it does have OSQL. This leaves me with some challenges:
>
>1. OSQL doesn't have the -W parameter to trim trailing spaces
>2. OSQL is wrapping the lines of output
>3. OSQL puts >1 >2 >3 >4 etc. at the top of the output file
>
>Any suggestions how I can overcome these problems?
>
>Phil.

Your item 2 might be corrected by using the -w parameter which "Allows
the user to set the screen width for output. The default is 80
characters. When an output line has reached its maximum screen width,
it is broken into multiple lines."

Your item 3 is corrected by using the -n parameter to remove
numbering.

Roy Harvey
Beacon Falls, CT

AddThis Social Bookmark Button