September 9, 2009 at 11:22 am
I'm using windows server 2003 with microsoft server enterprise sql manager which has a huge db stored on it of information. I need to query some of those information and format it in a specific way into a flat file (i.e., the firs 10 characters = client id, second 10 characters is the name). Whats the best way to do this?
My ideal setup would be - I would enter in the client id, it would query the sql for the rest of the information, then if its the correct one, output it the way i want to a flat file (txt). The main issue is outputting the selected data into a flat file in a specific format, I need to do this efficiently as it will probably be done often
September 9, 2009 at 11:33 am
Congratulations on your first post here.... 🙂
Welcome buddy.
You have planty of choices. Top 2 would be:
1. run SQLCMD with format file
2. use SSIS to export data
For further info, have a look at:
http://msdn.microsoft.com/en-us/library/ms162773(SQL.90).aspx
May 13, 2010 at 9:54 pm
Hi;
hope this could help you
DECLARE @cmd sysname, @var sysname
SET @var = 'Hello world'
SET @cmd = 'echo ' + @var + ' > c:\\var_out.txt'
EXEC master..xp_cmdshell @cmd
May 14, 2010 at 4:36 pm
You could also tell SSMS to output your results to a file. This will allow you to tweak your query\T-SQL script however you want and then run it from right within SSMS and the output will be to a file.
Joie Andrew
"Since 1982"
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply