Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Scheduling tasks in SQL Server 2000

Author  Topic 

abuhassan

105 Posts

Posted - 2006-11-09 : 07:57:27
Hi all

I want to schedule a task that checks if a file(s) exists on d:\Acc\ and then run the sql script shown below i.e. with the file(s) to load the content of the file(s) every day new files will be loaded. after the file(s) are loaded the file(s) are deleted.

I currently can achieve the above using Java and sql server and running the program as a scheduled task... (only reason for change would be that i wouldnt require java, JDBC etc to run the software it would be easy manage, migrate etc)

I wanted to find out if it can be done with sql server directly? (i.e. check if file exist and ased on that carryout the task or other wise just ignore) What do i need to look for? does sql server have a procedural language in it to be used for such thing? does sql server have an inbuilt task scheduler?

I am currently using the following script in a java program please note that i have used fixed values in this script for readabliity (of what i am doing)..



@bulk_cmd varchar(1000)
SET @bulk_cmd = 'BULK INSERT AccInv..VW_AccInvoice
FROM ''d:\Invbatch2001.txt''
WITH (FIELDTERMINATOR = '','', ROWTERMINATOR = '''+CHAR(10)+''')'
EXEC(@bulk_cmd)


abuhassan

105 Posts

Posted - 2006-11-09 : 08:27:21
any ideas?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-09 : 08:39:30
you can use SQL Agent to schedule the sql script. Or you can also consider doing it inside DTS where you can perform the checking of file existance


KH

Go to Top of Page

abuhassan

105 Posts

Posted - 2006-11-09 : 09:37:53
thanks

Go to Top of Page
   

- Advertisement -