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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-03-01 : 07:50:34
|
| Shawn writes "I have a project where I have to ftp a file to a client everyday. Right now I have built it out in a stored proc that uses xp_cmdshell to echo to a file that I give a dynamic date based name (file.2252004.txt). I love this solution but the only problem is the information that I output NEEDS to be one long string of non-delimited data and echo has a limit of 128 characters! The data for each record is about 300 characters long and is the same for each record.I would love to have a stored proc do the work rather than using DTS but will use it if I have to. The reason why I am shying away from DTS is the fact that I can not have a delimiter. One option would be to build the datastring and store it in a table and then export the single column of data for each record I send. Not really sure how I would do this just yet..I assume that people are doing this in companies all over the world and just need someone to be like "this is the path to go down, it makes the most sense" so then I can research the heck out of that path and if someone provided some sample code I would not be sad about that ; )Any help is appreciatted!Shawn" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-03-01 : 08:03:19
|
| Good man.You can do this by a number of echo's followed by a concatenate maybe, not sure whether this would put in a line feed between them though.Otherwise try putting the data into a global temp table then using bcp or osql to create the file.seehttp://www.nigelrivett.net/WriteTextFile.htmlFor the FTP have a look at http://www.nigelrivett.net/s_ftp_PutFile.htmlbut I guess you already have that sorted.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|