How to Schedule a SQL Server Database Creation Script
By gyani1978
@gyani1978 (147)
India
May 15, 2011 1:57am CST
Hi Friends,
I want to create a Job scheduler in SQL Server 2008 that should be create a log in text file and stored in some other drive automatically. So for that I think I must need some script. So may be you can give me the right suggestion for solving this issue.
Thanks.
1 response
@RamRes (1723)
• Argentina
16 May 11
But what kind of log are you trying to do? Will it periodically scans the state of some database and write it out to a log? Or is some kind of data extraction process that must be run periodically? Or will it be a log of certain activities done on the data? I don't clearly understand what you are trying to accomplish.
Now to another point. SQL Server is not very good at handling text file directly. It's good at managing tables and the data there, but to use text files you must resort to some tricks that also involve some security risk, to name some, enable some extended stored procedures that allow file system access, or write an unsafe CLR procedure for example. The right answer depends on your particular needs, but I think at a first glance that writing a text file is not a job for SQL Server, but a task that belongs to an external program, perhaps being run regularly by the Windows task manager or running as a system service.