dbTalk Databases Forums  

how to check table existence before transform task?

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


Discuss how to check table existence before transform task? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Nicholson
 
Posts: n/a

Default how to check table existence before transform task? - 11-06-2003 , 04:58 PM






Would anyone know how to check for the existence of a table before starting
a transform task against it? I.e. if the table exists, go ahead and copy
it, but if not, exit the package without an error message.

thanks, -marty nicholson



Reply With Quote
  #2  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: how to check table existence before transform task? - 11-06-2003 , 05:47 PM






IF OBJECT_ID('owner.YourTable') IS NULL
-- Get out now

--

Andrew J. Kelly
SQL Server MVP


"Martin Nicholson" <mgnicholsonNOSPAM (AT) hotmailNOSPAM (DOT) com> wrote

Quote:
Would anyone know how to check for the existence of a table before
starting
a transform task against it? I.e. if the table exists, go ahead and copy
it, but if not, exit the package without an error message.

thanks, -marty nicholson





Reply With Quote
  #3  
Old   
Martin Nicholson
 
Posts: n/a

Default Re: how to check table existence before transform task? - 11-06-2003 , 07:21 PM



Thanks for the reply.

I understand the "IF OBJECT_ID" part, it's the "Get out now" part that I am
struggling with. It looks like a transformation task wants a rowset
returned, or at least a row count, or else it errors out with "invalid
pointer". What I want to do is return nothing, but have no error. In my
case, the table not existing is not considered an error.

Is there some way thru SQL that I can return a DTS code such as
DTSTransformStat_OK, or can it only be done in an activeX script?

thanks again. -marty nicholson

"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote

Quote:
IF OBJECT_ID('owner.YourTable') IS NULL
-- Get out now

--

Andrew J. Kelly
SQL Server MVP


"Martin Nicholson" <mgnicholsonNOSPAM (AT) hotmailNOSPAM (DOT) com> wrote in message
news:O$rDFmLpDHA.1672 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Would anyone know how to check for the existence of a table before
starting
a transform task against it? I.e. if the table exists, go ahead and
copy
it, but if not, exit the package without an error message.

thanks, -marty nicholson







Reply With Quote
  #4  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: how to check table existence before transform task? - 11-07-2003 , 07:03 AM



See if this gives you any ideas:

http://www.sqldts.com/default.aspx?214

--

Andrew J. Kelly
SQL Server MVP


"Martin Nicholson" <mgnicholsonNOSPAM (AT) hotmailNOSPAM (DOT) com> wrote

Quote:
Thanks for the reply.

I understand the "IF OBJECT_ID" part, it's the "Get out now" part that I
am
struggling with. It looks like a transformation task wants a rowset
returned, or at least a row count, or else it errors out with "invalid
pointer". What I want to do is return nothing, but have no error. In my
case, the table not existing is not considered an error.

Is there some way thru SQL that I can return a DTS code such as
DTSTransformStat_OK, or can it only be done in an activeX script?

thanks again. -marty nicholson

"Andrew J. Kelly" <sqlmvpnooospam (AT) shadhawk (DOT) com> wrote in message
news:uTBHqBMpDHA.384 (AT) tk2msftngp13 (DOT) phx.gbl...
IF OBJECT_ID('owner.YourTable') IS NULL
-- Get out now

--

Andrew J. Kelly
SQL Server MVP


"Martin Nicholson" <mgnicholsonNOSPAM (AT) hotmailNOSPAM (DOT) com> wrote in
message
news:O$rDFmLpDHA.1672 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Would anyone know how to check for the existence of a table before
starting
a transform task against it? I.e. if the table exists, go ahead and
copy
it, but if not, exit the package without an error message.

thanks, -marty nicholson









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.