writing to a .txt file using SQL server agent Job
Hello I have created job which runs every hour to get data from SQL server table based upon current date and time. SQL statement SELECT timecrawl, MainTitleCrawl,dateweb FROM SchedulingModule where (DATEDIFF(day, GETDATE(),DateWeb) =0 and timeweb >= CONVERT(VARCHAR,getdate(),108)) or DATEDIFF(day, GETDATE(),DateWeb) =1 order by dateweb I can create a text file(using steps to provide the output file name ) but it has more details than needed. text file has this data Job 'MyJob' : Step 1, 'CreateCrawlText' : Began Executing 2012-08-13 13:26:00 timecrawl MainTitleCrawl dateweb ---------- ------------------------- ---------- 2:00 PM American Cinema 2012-08-13 1:00 AM American Cinema 2012-08-14 2:00 AM (null) 2012-08-14 3:00 AM (null) 2012-08-14 (4 rows(s) affected) I just need the data separated by tab as below. 2:00 PM American Cinema 2012-08-13 1:00 AM American Cinema 2012-08-14 2:00 AM (null) 2012-08-14 3:00 AM (null) 2012-08-14 how can I do that? Any help is appreciated, thanks Shivani st
August 15th, 2012 3:13pm

You "could" use BCP out which would give you more control over formatting. http://msdn.microsoft.com/en-us/library/ms162802.aspx
Free Windows Admin Tool Kit Click here and download it now
August 15th, 2012 8:34pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics