Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Finarfin
Starting Member
28 Posts |
Posted - 2004-06-08 : 04:19:57
|
| Hi,the following query isn't working, do you know why???CREATE PROCEDURE CREATE_TABLE_TMPAScreate table if not exists proto_tmp(nouveauCode_tmp nvarchar(10), ancienCode_tmp nvarchar(8), client_tmp int, pays_tmp nchar(2), annee_tmp int, statut_tmp nvarchar(3))GOgenerates the following errors:Serveur : Msg 156, Niveau 15, État 1, Ligne 1Incorrect syntax near the keyword 'if'.Serveur : Msg 170, Niveau 15, État 1, Ligne 1Line 1: Incorrect syntax near 'proto_tmp'.Thank you all,Romain |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-08 : 04:22:19
|
| You can't use if not exists like that... look up create table in BOL.. |
 |
|
|
Finarfin
Starting Member
28 Posts |
Posted - 2004-06-08 : 04:35:41
|
| Ok, may be I should use temporary table...Thank you all,Romain |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-08 : 05:38:16
|
You can do...if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[proto_tmp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)create table (...) |
 |
|
|
|
|
|
|
|