I am using MS SQL 6.5.
There is a .bat file on server, it calls a stored procedure.
The stored procedure selects few fields from a table. (select a, b, c from tbl1).
It also calculates few fields. select d = a + 1, e = ......
I haven't described all the fields, but you get the picture.
It writes selected, and calculated fields to a text file using 'PRINT' command (selet @msg = format(a) + '<' format (b) + '<' ....)
BTW, ('<' is used as field separator in BCP)
Then it issues print command (PRINT @msg)
The problem is, print command puts all fields on one line most of the times. However, sometimes, it puts all fields on two lines, few fields on line 1, and rest on line 2.
Then, .bat file takes the text file and loads it on to a second table using BCP.
When BCP finds one record splited into two lines, sometimes, it doesn't handle some date fields right.
Does anyone know how we can make print command write all fields on one line. It does right most of the times, but not all the time.
I will appreciate the help.
There is a .bat file on server, it calls a stored procedure.
The stored procedure selects few fields from a table. (select a, b, c from tbl1).
It also calculates few fields. select d = a + 1, e = ......
I haven't described all the fields, but you get the picture.
It writes selected, and calculated fields to a text file using 'PRINT' command (selet @msg = format(a) + '<' format (b) + '<' ....)
BTW, ('<' is used as field separator in BCP)
Then it issues print command (PRINT @msg)
The problem is, print command puts all fields on one line most of the times. However, sometimes, it puts all fields on two lines, few fields on line 1, and rest on line 2.
Then, .bat file takes the text file and loads it on to a second table using BCP.
When BCP finds one record splited into two lines, sometimes, it doesn't handle some date fields right.
Does anyone know how we can make print command write all fields on one line. It does right most of the times, but not all the time.
I will appreciate the help.