The "right" way to do it would be to write a short script or app in .NET,
Perl, or some other language to perform this function. SQL is very limited
in what it can do as far as input and output. This function doesn't belong
on the server. There's probably a way to do it, but it won't be efficient
and it probably won't be pretty or easy in T-SQL. If you want to do it in
T-SQL, look up COPY < CON or similar commands at the command prompt HELP.
[quoted text, click to view] "Hoosbruin" <Hoosbruin@Kconline.com> wrote in message
news:cYydnfW27fk73GTfRVn-qA@kconline.com...
> I'm trying to create a text file that I can send to rightfax for automatic
> delivery. Here is what I have so far.
>
> declare @startstring char(80),
> @endstring1 char(80),
> @endstring2 char(80),
> @endstring3 char(80),
> @endstring4 char(80),
> @endstring5 char(80)
>
> Set @startString = char(27) + '&l8D ' + char(27) + '&l3E ' + char(27) +
> '&l85F' + char(27) + '(s11H ' + char(27) + 's3B ' + char(00) + char(13) +
> char10)
> Set @data = 'Hello' + char(0) + char(13) + char(10)
> Set @endstring1 = char(12) + ' ' + char(0) + char(13) + char(10)
> Set @endstring2 = char(27) + '(10U' + char(0) + char(13) + char(10)
> Set @endstring3 = '<TOFAXNUM:9999999999>' + char(0) + char(13) + char(10)
> Set @endstring4 = '<TOFAXNAME:jimbob>' + char(0) + char(13) + char(10)
>
>
> I need to create a text file that look like this. Can xp_cmdshell create
> the text file (faxsend.txt).
>
> @startstring ---> on the first line
> @data ---> 2nd line
> @endstring1 ----> 3rd line
> @endstring2 ----> 4th line
> @endstring3 ----> 5th line
> @endstring4 ----> 6th line
>
> Thanks.
>
>
>