I'm trying to schedule a daily job to pull out specific data from a table that gets added every night. I accessed Jobs icon under SQL server agent and proceeded to creating a job using 'new job'.
A new table gets created with the name prathab_table_date (Name changed due to security reasons.) I would like to pull out data matching the domain name (domain name is a field in this particular table) 'xxx' and I go onto define what other fields I would like to see along with that. In the properties window, I went to steps tab and here is what my command looks like.
SELECT field A, field B, field C, field D, domainname
FROM prathab_table
WHERE (DOMAINNAME = 'xxx')
On this very window, I selected the type to be transact-SQL script (TSQL). There are quite a few options to choose from such as operating system command (CmdExec) DTS, replication distributor, etc.
While my query works, there are couple of things it wont do for me. Where exactly do I define what type of report I would like, for example, a CSV file, excel file, word doc. Secondly, since my table gets added the date with the table name prathab_table_todaysdate, how can I define this so that that day's date will get appended to the query, before its run.
We dont necessarily have to use transact SQL, as long as it works, I'm ok with any mechanism.
Thanks for your help in advance.
PK
Start Free Trial