I have created the output file using BCP successfully. I am using a BCP query on a temp table created by a more complex query. This is all embeded in a command to run using xp_cmdshell.
bcp "select * from ##WISCTBL" queryout "c:\temp\WISC_FILE_20080709.txt" -T -c
When I look at the output there is a row of data, then a blank row, and then a row of data, etc... The user wants to see the data fixed width (done this) with row after row of data.
My question is how do I get rid of the extra blank row?
Can i use the following EXEC master..xp_cmdshell 'bcp "EXEC sp_helptext SPNAME" queryout "c:\data.txt" -T -c' ? Here I'm getting the error as Error = [Microsoft][SQL Native Client][SQL Server]Invalid object name '#CommentText'.
Ok, Now I reply to an old topic, but hey can't resist it.
xp_cmdshell is for the whole server while TRUSTWORTHY is for one database only. I tend to think CLR is a lot safer (when used properly) than letting xp_cmdshell being used.