Check if a table exists
From: Kirk (Kirk_at_discussions.microsoft.com)
Date: 06/22/04
- Next message: Ilya Margolin: "Re: instead of trigger question"
- Previous message: Hari Prasad: "Re: How can I create Database Schema of all databases automatically?"
- Next in thread: Aaron [SQL Server MVP]: "Re: Check if a table exists"
- Reply: Aaron [SQL Server MVP]: "Re: Check if a table exists"
- Reply: J O Holloway: "Re: Check if a table exists"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Jun 2004 10:15:02 -0700
I am running Sql Server 7.0 and I am using a store procedure to drop a global temp table if it exists.
Currently, it looks like this:
if object_id('##Table') is null
print 'True'
else
print 'False'
Drop Table ##tmpTable
It works fine through Query Analyzer, but when I try to execute this code through ASP code, I get the following error:
Microsoft OLE DB Provider for SQL Server error '80040e09' With the statement printing out TRUE that the table doesn't exist. And if doesn't exist, it should continue on and create the table as instructed.
Any ideas as to what I am doing wrong? Is there a better way to check as to whether or not a table exists? Any help would be appreciated.
Thanks.
Kirk
- Next message: Ilya Margolin: "Re: instead of trigger question"
- Previous message: Hari Prasad: "Re: How can I create Database Schema of all databases automatically?"
- Next in thread: Aaron [SQL Server MVP]: "Re: Check if a table exists"
- Reply: Aaron [SQL Server MVP]: "Re: Check if a table exists"
- Reply: J O Holloway: "Re: Check if a table exists"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|