The information in this article applies to:
SYMPTOMSIf a CREATE TABLE statement is placed inside an IF block to prevent re- creating a table that already exists, the duplicate table name error will still be raised. WORKAROUND
When a query is submitted, object existence and resolution is done at parse
time, not execution time. This will cause the CREATE TABLE statement to
fail the query with the 2714 error.
The following code does not work properly:
Since there are times when you do not want to drop the table, the following procedure can be used: Run the following script once on each server where the table needs to used, preferably when nobody else is accessing the table. The script will create a stored procedure that will build the table. It is necessary to rename the table so that the stored procedure TAB_CREATE will compile without error when created.
Once the above script has been run, the following code can be used in scripts to resolve the duplicate table name error:
Additional query words: Transact-SQL Windows NT
Keywords : kbprg SSrvServer SSrvWinNT |
Last Reviewed: March 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |