if exists (select * from dbo.sysobjects where id = object_id(N’{databaseOwner}{objectQualifier}F_ARTICLE_UPDATE’) and OBJECTPROPERTY(id,
N’IsProcedure’) = 1)
drop procedure {databaseOwner}{objectQualifier}F_ARTICLE_UPDATE
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}F_ARTICLE_CREATE
@Title nvarchar(100),
@Content nvarchar(4000),
@CreateTime datetime,
@Author nvarchar(50)
AS
INSERT INTO {objectQualifier}article(title,content,createtime,author)VALUES(@Title,@content,@CreateTime,@author)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}F_ARTICLE_DELETE
@ID INT
AS
DELETE FROM {databaseOwner}[{objectQualifier}article] WHERE [ID]=@ID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}F_ARTICLE_GETALL
AS
SELECT * FROM {databaseOwner}[{objectQualifier}article]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}F_ARTICLE_GETDETAILS
@ID int
AS
SELECT * FROM {databaseOwner}[{objectQualifier}article] WHERE [ID]=@ID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}F_ARTICLE_UPDATE
@ID int,
@Title nvarchar(100),
@Content nvarchar(4000),
@CreateTime datetime,
@Author nvarchar(50)
AS
UPDATE {databaseOwner}[{objectQualifier}article] SET Title=@Title,Content=@Content,CreateTime=@CreateTime,author=@Author
WHERE [ID]=@ID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
注意:如果是生成的脚本,要在存储过程名称和表名称前如上所示加上{databaseOwner}{objectQualifier}.
生成的脚本如果出现先建立存储过程后建表的现实,要把顺序更正,否则会出现错误。
脚本生成之后,要用正确的命名方式命名:01.00.00.SqlDataProvider(等下面谈到建立项目时模板会自动添加正确格式的数据脚本文件,把这些脚本复制粘贴过去即可)。
至此,数据库脚本建立完毕。