dcsimg
Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
SQL Scripts & Samples
Tips
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:
DatabaseDaily  

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed


Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

MS SQL

Posted Mar 3, 2004

"File Watcher" for SQL Server

By Muthusamy Anantha Kumar aka The MAK

SQL Server Database administrators often come across situations where the scheduled DTS jobs failed because the Source File didn't arrive on time. It is a tedious process to cleanup if there are dependent jobs that have run before the first DTS job completed successfully. The intent of this article is to provide a solution for that kind of situation.

Let's simulate the whole scenario of "File Watcher" Job.

What is "File Watcher"

File Watcher is a SQL job that looks for the existence of a file in a particular folder every few minutes. If that particular file arrives, it will trigger another job.

Let's assume that a CSV file "File.csv," such as the one below, is going to be copied to C:\Fileimport from an external job. This copying may happen any time between 6 AM and 9 AM.

Process.csv

ServerName,ServerType,ID
MSDEBox ,Test,12
Yukon,BetaTesting,23
PRODSQL,Production,24

Create table

Create tables in the database as shown below.

Use test
Go
CREATE TABLE [FIle] (
[ServerName] varchar (255) NULL, 
[ServerType] varchar (255) NULL, 
[ID] varchar (255) NULL )
go
CREATE TABLE [Logtable] (
[ID] int identity(1,1),
[Status] varchar (255) NULL,
[Date] datetime default getdate())


MS SQL Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM