arrowhouse
MIS
I am trying to replace a process that outputs to a text file using osql. The requirement that I have been given is that the text file must exactly match the format & content of the file that osql produces.
An example osql command that is used to generate the file is
osql -h-1 -w 1100 -s "^" /E /b /d MyDb /S "MyServer" /Q"SET NOCOUNT ON;SELECT * FROM MyTable" -o MyFile.txt
Looking at the original file output by osql, it seems to pad the fields - possibly the rule is left pad, what I shall loosly call, numericly based and right pad charater based ones.
The new process is intended to consist of running a sql statement from a .Net application that will then do additional processing on the record set & create the file. (Ok. I've slightly simplified what the endpoint is - there is good reason to be using .Net to get to the endpoint - but this is enough of an essay alreay!)
Does anybody know what the rules are for the padding that osql does on outputting to a text file? I either need to generate a SQL statement that provides the data with the required padding, or be able to explain the logic so we can code it so the text file created exactly matches the original version.
Thanks
An example osql command that is used to generate the file is
osql -h-1 -w 1100 -s "^" /E /b /d MyDb /S "MyServer" /Q"SET NOCOUNT ON;SELECT * FROM MyTable" -o MyFile.txt
Looking at the original file output by osql, it seems to pad the fields - possibly the rule is left pad, what I shall loosly call, numericly based and right pad charater based ones.
The new process is intended to consist of running a sql statement from a .Net application that will then do additional processing on the record set & create the file. (Ok. I've slightly simplified what the endpoint is - there is good reason to be using .Net to get to the endpoint - but this is enough of an essay alreay!)
Does anybody know what the rules are for the padding that osql does on outputting to a text file? I either need to generate a SQL statement that provides the data with the required padding, or be able to explain the logic so we can code it so the text file created exactly matches the original version.
Thanks