April 14, 2008 at 3:21 pm
Hello,
I've got two problems with this task:
First, I could get the file to be created in a tab delimited format...the table has 40 columns and on the 40th column instead of a line break (that i wanted) it would insert a TAB. This caused the external program that is importing the text file to fail.
Second, i've tried changing the arguments to -w -T -S Servername -U SA -P pwd
and when that didn't work (it inserted a line break after the 4th column for some reason), I reverted back to the original OSQL and now my text file won't even import cleanly into Access or Excel...there are some extra characters in it that are corrupting it now.
osql.exe -U SA -P pwd -d HOTEL -S Servername -n -i vsm_his2he.sql -o log.txt
bcp.exe HOTEL.DBO.hotel_expert_room_registry out "out.txt" -c -T -S Servername -U SA -P pwd
net use X: /DELETE
net use X: \\vsmsvr-hexpert\fofile
xcopy out.txt X:\ /Q /Y
net use X: /DELETE
exit
Does anyone know how to do this right?
April 18, 2008 at 9:54 am
April 18, 2008 at 10:52 am
thanks, i ended up doing a parameter file and putting in the /n on the last column...
40 SQLCHAR 0 12 "\r" 40 honor SQL_Latin1_General_CP1_CI_AS
for some reason it won't show the "backslash n" after the "\r....but i have that in there...
it works now...but mostly it was the vendors issue that they couldn't import it...
April 21, 2008 at 5:20 am
How to export sql server data into multiple excel sheets ?
I don't want to do this from DTS or SSIS. i have dalready done this from OPENROWSET, but only single excel sheet, i want to export data on multiple attached excel sheets on per day bases.
Pls. any one respond . this is urgent and important for me.
thanks.
April 21, 2008 at 5:26 am
{ Just realised that this was cross-posted - don't do that!!}
😀
Answer moved to new thread that was created here:
http://www.sqlservercentral.com/Forums/Topic487837-19-1.aspx
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply