in reply to T-SQL problem - Perl solution?
The object_id() function is still available in SQL 2000 and still returns NULL if you supply the name of a non-existent table - try this example -
use pubs go if object_id('jobs') is not null print 'jobs table exists' else print 'jobs table does not exist' go --- jobs table exists
A better way would be to query the database schema, rather than abuse the object_id() function. Something like this:
use pubs go if exists(select 1 from information_schema.tables where table_name = ' +jobs') print 'jobs table exists' else print 'jobs table does not exist' go
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: T-SQL problem - Perl solution?
by Win (Novice) on Oct 25, 2004 at 13:52 UTC | |
by monktim (Friar) on Oct 25, 2004 at 14:17 UTC | |
by EdwardG (Vicar) on Oct 25, 2004 at 14:57 UTC | |
by monktim (Friar) on Oct 25, 2004 at 15:36 UTC | |
by EdwardG (Vicar) on Oct 25, 2004 at 13:59 UTC |