amickfarms
asked on
SQL 2008 Output to Text File
I have sql 2008 r2 and am needing to create a text file from a query result. The data will need to be in certain row,character locations in the the text fields as it will be used to import into an existing system. Can someone point me a direction of what sql commands to use? I eventually would configure it as a stored procedure to run on a fixed interval of time.
http://www.sqlservercurry.com/2007/12/redirect-select-query-output-to-text.html
ASKER
That really doesn't give me the results I was aiming for. I need to place data in certain row,character locations in the text file. A little more than just dropping to a text file.
i'm not sure what you're looking for then
you want it to be formatted a specific way? if so, you may want to look at using char/nchar data types instead of varchar/nvarchar
those will be padded with spaces at the end, so if you want your file to look like
COLA.....COLB......etc
COA.......COB.......etc
char will pad the necessary # of spaces
not sure if that helps?
you want it to be formatted a specific way? if so, you may want to look at using char/nchar data types instead of varchar/nvarchar
those will be padded with spaces at the end, so if you want your file to look like
COLA.....COLB......etc
COA.......COB.......etc
char will pad the necessary # of spaces
not sure if that helps?
ASKER
That may work. I will work with this for a while and see what I can come up with.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had to use oterh SQL functions to make this work. Still not finished with the project.