dbTalk Databases Forums  

SSIS: connect to the database within a Script task (vb.net)

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss SSIS: connect to the database within a Script task (vb.net) in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Panos Stavroulis.
 
Posts: n/a

Default SSIS: connect to the database within a Script task (vb.net) - 05-17-2006 , 03:56 AM






Hi,

I need to be able to query the database within a Script task. I basically
need to get the current connection and then execute some sql or stored proc
and find out what's in the database and based on this info make a decision in
the script. Does anybody know how to do this?

I've tried few things but no luck, fairly new with .net. This is all sql
server 2005 ssis package.

Thanks,

Panos


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS: connect to the database within a Script task (vb.net) - 05-17-2006 , 06:34 PM






Hello Panos Stavroulis.,


Why do you need to do this in a Script task? SSIS is far more flexible than
DTS and you can probably do what you want without doing it through a Script
task.




Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
Hi,

I need to be able to query the database within a Script task. I
basically need to get the current connection and then execute some sql
or stored proc and find out what's in the database and based on this
info make a decision in the script. Does anybody know how to do this?

I've tried few things but no luck, fairly new with .net. This is all
sql server 2005 ssis package.

Thanks,

Panos




Reply With Quote
  #3  
Old   
Panos Stavroulis.
 
Posts: n/a

Default Re: SSIS: connect to the database within a Script task (vb.net) - 05-18-2006 , 03:00 AM



Hi Allan,

Thanks for this. Well what I want to do is query the database, find out if a
file exists there then if not then copy the file to a dir for processing. I
know I can do this in a sql task but then I'll have to store the results,
possibly hundreds into a variable. Then I can retrieve the results of the
variable one by one?.

So do you think it's better doing that and storing the result sets into a
variable? would you suggest Object as the best type to use for my container
variable?

Thanks,

Panos.

"Allan Mitchell" wrote:

Quote:
Hello Panos Stavroulis.,


Why do you need to do this in a Script task? SSIS is far more flexible than
DTS and you can probably do what you want without doing it through a Script
task.




Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Hi,

I need to be able to query the database within a Script task. I
basically need to get the current connection and then execute some sql
or stored proc and find out what's in the database and based on this
info make a decision in the script. Does anybody know how to do this?

I've tried few things but no luck, fairly new with .net. This is all
sql server 2005 ssis package.

Thanks,

Panos





Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS: connect to the database within a Script task (vb.net) - 05-18-2006 , 04:43 AM



Hello Panos Stavroulis.,

When you say a file do you mean a table?

A variable can hold a rowset so you can hold more than one value in there.
With your method how would you not have to query the DB multiple times.
If your method would not require this then neither does the ExecuteSQL task
way either


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
Hi Allan,

Thanks for this. Well what I want to do is query the database, find
out if a file exists there then if not then copy the file to a dir for
processing. I know I can do this in a sql task but then I'll have to
store the results, possibly hundreds into a variable. Then I can
retrieve the results of the variable one by one?.

So do you think it's better doing that and storing the result sets
into a variable? would you suggest Object as the best type to use for
my container variable?

Thanks,

Panos.

"Allan Mitchell" wrote:

Hello Panos Stavroulis.,

Why do you need to do this in a Script task? SSIS is far more
flexible than DTS and you can probably do what you want without doing
it through a Script task.

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com
Hi,

I need to be able to query the database within a Script task. I
basically need to get the current connection and then execute some
sql or stored proc and find out what's in the database and based on
this info make a decision in the script. Does anybody know how to do
this?

I've tried few things but no luck, fairly new with .net. This is
all sql server 2005 ssis package.

Thanks,

Panos




Reply With Quote
  #5  
Old   
Panos Stavroulis.
 
Posts: n/a

Default Re: SSIS: connect to the database within a Script task (vb.net) - 05-18-2006 , 05:02 AM



No I mean a file on the drive. So have to ckeck if the file name exists in
the database then returnn back the result. It will have to be done with
200-300 calls to an sp can't be done with just one sp call. That's why I
wanted to call the sp within a script and not within a sp task.

Then if a file needs further processing has to be stored in a global
variable for use by other tasks. So what I need is a variable which will
contain file1.txt, file2.txt etc. Hope it makes more sense now. Thanks.

"Allan Mitchell" wrote:

Quote:
Hello Panos Stavroulis.,

When you say a file do you mean a table?

A variable can hold a rowset so you can hold more than one value in there.
With your method how would you not have to query the DB multiple times.
If your method would not require this then neither does the ExecuteSQL task
way either


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Hi Allan,

Thanks for this. Well what I want to do is query the database, find
out if a file exists there then if not then copy the file to a dir for
processing. I know I can do this in a sql task but then I'll have to
store the results, possibly hundreds into a variable. Then I can
retrieve the results of the variable one by one?.

So do you think it's better doing that and storing the result sets
into a variable? would you suggest Object as the best type to use for
my container variable?

Thanks,

Panos.

"Allan Mitchell" wrote:

Hello Panos Stavroulis.,

Why do you need to do this in a Script task? SSIS is far more
flexible than DTS and you can probably do what you want without doing
it through a Script task.

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com
Hi,

I need to be able to query the database within a Script task. I
basically need to get the current connection and then execute some
sql or stored proc and find out what's in the database and based on
this info make a decision in the script. Does anybody know how to do
this?

I've tried few things but no luck, fairly new with .net. This is
all sql server 2005 ssis package.

Thanks,

Panos





Reply With Quote
  #6  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS: connect to the database within a Script task (vb.net) - 05-18-2006 , 05:28 AM



Hello Panos Stavroulis.,

There will be no difference then.

You could loop over the files and then do with that info what you will.
I really see no difference in either solution.


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
No I mean a file on the drive. So have to ckeck if the file name
exists in the database then returnn back the result. It will have to
be done with 200-300 calls to an sp can't be done with just one sp
call. That's why I wanted to call the sp within a script and not
within a sp task.

Then if a file needs further processing has to be stored in a global
variable for use by other tasks. So what I need is a variable which
will contain file1.txt, file2.txt etc. Hope it makes more sense now.
Thanks.

"Allan Mitchell" wrote:

Hello Panos Stavroulis.,

When you say a file do you mean a table?

A variable can hold a rowset so you can hold more than one value in
there. With your method how would you not have to query the DB
multiple times. If your method would not require this then neither
does the ExecuteSQL task way either

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com
Hi Allan,

Thanks for this. Well what I want to do is query the database, find
out if a file exists there then if not then copy the file to a dir
for processing. I know I can do this in a sql task but then I'll
have to store the results, possibly hundreds into a variable. Then I
can retrieve the results of the variable one by one?.

So do you think it's better doing that and storing the result sets
into a variable? would you suggest Object as the best type to use
for my container variable?

Thanks,

Panos.

"Allan Mitchell" wrote:

Hello Panos Stavroulis.,

Why do you need to do this in a Script task? SSIS is far more
flexible than DTS and you can probably do what you want without
doing it through a Script task.

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com
Hi,

I need to be able to query the database within a Script task. I
basically need to get the current connection and then execute some
sql or stored proc and find out what's in the database and based
on this info make a decision in the script. Does anybody know how
to do this?

I've tried few things but no luck, fairly new with .net. This is
all sql server 2005 ssis package.

Thanks,

Panos




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.