发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
C#技术学习之-实际数据库例子建立的SQL命令:
为了方便以后测试,把SQL2000中几个表的和存储过程的命令保存在此,测试的时候,需要建立这些表;
另外,SQL连接数据库的字符串保存在Web.config之中。
#region "SQL建立命令"
/*
create Procedure Pr_AddRole
(
@RoleName varchar(255),
@Description text
)
as
declare @RecordCount as int
Set @RecordCount =
(
Select count(*) From Role Where Role_Name= @RoleName
)
if @RecordCount<1
Begin
Insert into Role(Role_Name,Role_Description)
values
(@RoleName,@Description)
return @@Identity
End
GO
* */
/*
* if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Role]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Role]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[StaffRole]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[StaffRole]
GO
CREATE TABLE [dbo].[Role] (
[Role_ID] [int] IDENTITY (1, 1) NOT NULL ,
[Role_Name] [varchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[Role_Description] [text] COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[StaffRole] (
[Staff_ID] [int] NULL ,
[Role_ID] [int] NULL
) ON [PRIMARY]
GO
* */
#endregion
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。