SQL:IFEXISTS(SELECT*FROMsys.all_objectsWHEREobject_id=OBJECT_ID('[dbo].[activity]')ANDtypeIN('U'))DROPTABLE[dbo].[activity]GOCREATETABLE[dbo].[activity]([id]bigintprimary...
SQL:
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID('[dbo].[activity]') AND type IN ('U'))
DROP TABLE [dbo].[activity]
GO
CREATE TABLE [dbo].[activity] (
[id] bigint primary key IDENTITY(1,1) NOT NULL,
[name] varchar(25) NOT NULL,
[dept] varchar(25) NOT NULL,
[post] varchar(25) NOT NULL,
[mobile] varchar(25) NOT NULL DEFAULT '',
[mail] varchar(128) NOT NULL DEFAULT '',
[articleId] bigint NOT NULL,
[userId] bigint NOT NULL,
[userName] varchar(64) NOT NULL DEFAULT '',
[createdTime] datetime NULL DEFAULT NULL
)
ON [PRIMARY]
GO
異常:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID('[dbo].[act' at line 1
展開