if (1st table exists) then select date from 1st table and call a (procedure) how to do this?
2 Answers
I like this method for checking an objects existence.
IF Object_ID('dbo.your_table', 'U') IS NOT NULL
BEGIN
/* Table exists */
END
ELSE
BEGIN
/* Table does not exist */
END
The Object_ID() function returns the... object_id(!) of the specified object. If the object doesn't exist then it returns NULL. The second [optional] parameter being passed here is a U which is the object type (U=User table, V=View, P=Procedure... see type column here for more info here).
Basically this is a short hand (lazy? ahem) method of checking for an objects existence
1 Comment
gvee
assumed this was for SQL Server... Apologies if not!
swl(in your title) !?!?!? What/who is that ?