if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_TABLE1_category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[TABLE1] DROP CONSTRAINT FK_TABLE1_category
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[category]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[category]
GO
CREATE TABLE [dbo].[category] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[level] [int] NULL ,
[parentId] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[category] ADD
CONSTRAINT [PK_category] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GO