473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

long SQL lines for osql

We have a very long and complicated SQL script which we run to upgrade
a version of our software from old to new. It works great in Query
Analyzer, but when run through osql it takes errors on lines that are
very long and (I think) stops reading after a certain amount of
characters. I've searched the net but haven't found anyone mentioning
this before. I have tried the -w 5000 parm to no avail.

Any suggestions?

Feb 23 '06 #1
4 2606
pb648174 (go****@webpaul.net) writes:
We have a very long and complicated SQL script which we run to upgrade
a version of our software from old to new. It works great in Query
Analyzer, but when run through osql it takes errors on lines that are
very long and (I think) stops reading after a certain amount of
characters. I've searched the net but haven't found anyone mentioning
this before. I have tried the -w 5000 parm to no avail.


-w controls the width of the output. As I understand it, you have
problems with the input.

One thing to keep in mind, is by default OSQL runs with QUOTED_IDENTIFIER
off, which is different from Query Analyzer. Run with -I to change this.

It would have helped if you had included any error messages.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 23 '06 #2
The error messages are bogus, i.e. it is stopping processing in the
middle of a line, i.e. "Ad" is not a column, when the line is doing
something with "Address". I'll try the -l option and see if that makes
a difference, but it doesn't seem like it would make a difference since
I am using standard name, i.e. nothing with brackets, quotes or spaces
in the names.

Feb 24 '06 #3
pb648174 (go****@webpaul.net) writes:
The error messages are bogus, i.e. it is stopping processing in the
middle of a line, i.e. "Ad" is not a column, when the line is doing
something with "Address". I'll try the -l option and see if that makes
a difference, but it doesn't seem like it would make a difference since
I am using standard name, i.e. nothing with brackets, quotes or spaces
in the names.


OK, it sounds like it chokes on something.

It could be the file size, but it could also be the batch size.

If it is the file size, you can split the file into several and then
include the files with ~r. (Well, maybe. It could choke on the total.
But you could try.)

If it is the batch size, maybe you can throw in more "go" of you have
very long batches.

I recall that we had an issue with INSERT-files that we generate
from Excel. I had to fix the tool, so that it added a "go" after
each 40th EXEC or so. But if memory serves, it was the ISQL/W 6.5
that had this problems.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 24 '06 #4
I haven't been able to reproduce it locally - it always happens during
our production push... Then I have to execute it in QA for every
database we have which is a pain. The total file size is about 2 MB and
there is a go after pretty much each statement.

Erland Sommarskog wrote:
pb648174 (go****@webpaul.net) writes:
The error messages are bogus, i.e. it is stopping processing in the
middle of a line, i.e. "Ad" is not a column, when the line is doing
something with "Address". I'll try the -l option and see if that makes
a difference, but it doesn't seem like it would make a difference since
I am using standard name, i.e. nothing with brackets, quotes or spaces
in the names.


OK, it sounds like it chokes on something.

It could be the file size, but it could also be the batch size.

If it is the file size, you can split the file into several and then
include the files with ~r. (Well, maybe. It could choke on the total.
But you could try.)

If it is the batch size, maybe you can throw in more "go" of you have
very long batches.

I recall that we had an issue with INSERT-files that we generate
from Excel. I had to fix the tool, so that it added a "go" after
each 40th EXEC or so. But if memory serves, it was the ISQL/W 6.5
that had this problems.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Feb 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ajay Garg | last post by:
I am running the following OSQL command and capturing the return code for the error .Whenver i have an error like server not exists or uable to login I get a return code of 1 for the...
5
by: Jay Chan | last post by:
I am trying to use a command line program to run a stored procedure that generates output in a comma-delimitted format. Somehow, ISQL or OSQL always wrap the lines at 256 characters. I believe this...
2
by: Murtix Van Basten | last post by:
Hi, I have dumped a very large database from mysql (using mysqldump program) as a raw sql file. The reason was, convert this database to a MSSQL database. Since mysqldump creates the file as raw...
1
by: Alan Zhong | last post by:
hi, i had been removed the row counts and the column spaces... but i failed to remove the extra tabs between rows of data return from the osql output. how to detect the row delimiter? i noticed...
24
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone out there has run into this issue before and can shed some light on it for me. I have a stored procedure that essentially does a mini ETL from a source...
1
by: john_20_28_2000 | last post by:
Will osql product an SQL backup? By this I mean a text file with the transact-sql in it so I can use it to recreate the database elsewhere? Thank you.
11
by: gopal | last post by:
Hi, I am trying to call the OSQL utility from my C# console application and i am having problems i have the following code In Main method ProcessStartInfo psi = new...
7
by: gopal | last post by:
Hi, I have a console application whose purpose is to run the OSQL utility from my console application. When my application is run, the OSQL utility is started and it has to prompt for...
5
by: gopal | last post by:
Hi I am running a OSQL utility from my console application . iam trying to install a huge SQL file of 5MB, i debugged my code and the application is not responding at the following line of code...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.