Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Trunacate

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-11-20 : 07:58:34
Dharmesh Gandhi writes "Hi,
I have very genuine problem while using osql.

I use osql utility where i cal a store procedure which uses table name and then fetches all data from that table and outputs the data in .sql file in form of INSERT INTO format.

First i populate data in temp table as a signle column table and then fetch each row and prepare the statmenet

INSERT INTO (col1, col2, col3)
VALUES (1,'abc', 'def')

but sometimes last single quote disappears.
SOme times when there is datetime data type date appeears as below

INSERT INTO (col1, col2, date1, col4)
VALUES (1,'abc', '11-11-2003
00:00:00.000',
'xz')

as date and time are on fdifferent line it raises error.
Can anybody hel me out?

Thnx,

Dharmesh"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-11-20 : 12:13:31
I suppose that everyone's questions here are very genuine.

Why would you want to output a SQL query. Is this for dynamic sql? If so, just use dynamic sql. Please explain what you are trying to do with the output.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-11-20 : 12:59:26
Nah...

he's got a sproc the generates INSERTS for a table

AND I bet the data is coming from a text field and probably has CRLF in there, or some other ASCII value...

Lets see the DDL for the table and the sproc, and the osql command...



Brett

8-)
Go to Top of Page
   

- Advertisement -