Groups | Blog | Home
all groups > sql server dts > november 2003 >

sql server dts : how to check table existence before transform task?


Martin Nicholson
11/6/2003 5:58:43 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

Andrew J. Kelly
11/6/2003 6:47:57 PM
IF OBJECT_ID('owner.YourTable') IS NULL
-- Get out now

--

Andrew J. Kelly
SQL Server MVP


[quoted text, click to view]

Martin Nicholson
11/6/2003 8:21:16 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

[quoted text, click to view]

Andrew J. Kelly
11/7/2003 8:03:34 AM
See if this gives you any ideas:

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

--

Andrew J. Kelly
SQL Server MVP


[quoted text, click to view]

AddThis Social Bookmark Button