Wednesday, March 28, 2012

Running a Script in DTS

I'm new to DTS.
The task that I want to do is that I want to run a SQL Script from DTS. I know that there is Execute SQL Task for the same purpose.

But my problem is that the Script that i have to run will be in a file and I have to first read the file in DTS.then execute the contents of the file.

The script file may contain :
create database SOMEDB

create table Table1 ( Col1 varchar(10), col2 int)

I tried to use the DTS file handling but when i try to create a FileSystemObject it gives me the error that it cannot create FileSystemObject. And even if i am able to read the File using the FileSystemObject how would I run what I have read.

Can you help me out.

If this is a DTS question (which I think it is) then you are in the wrong place. Hop over to microsoft.public.sqlserver.dts

This is an SSIS forum. SSIS is the successor to DTS.

If this is a question about SSIS then what you want can easily be achieved using the Execute SQL Task which is able to take the statement/script that is going to execute from a file. Just change the SQLSourceType property to "File connection".

-Jamie

No comments:

Post a Comment