SQLServer2005简单的存储过程

创建脚本
USE test;
GO
CREATE PROCEDURE up_select AS
select *
from news
order by title desc
GO
调用脚本
USE test;
GO
EXEC up_select
GO
lunzi   2007-10-09 22:37:43 评论:2   阅读:351   引用:0
带输入输出参数的 @2007-10-09 23:04:25  lunzi
执行脚本  
USE test;
GO
CREATE PROCEDURE up_search
(@id char(6),
@title varchar(15) OUTPUT,
@content varchar(15) OUTPUT
)
AS
SELECT @title = title,
   @content = content
FROM dbo.news
WHERE id = @id
GO
调用脚本
USE test;
DECLARE @title varchar(15)
DECLARE @content varchar(15)
EXEC up_search '12',@title OUTPUT,@content OUTPUT
PRINT '新闻标题为:'+@title
PRINT '新闻内容为: '+@content
GO
带参数的 @2007-10-09 22:46:08  lunzi
USE test;
GO
CREATE PROCEDURE up_insert
(@id char(6),
@title varchar(15),
@content varchar(15)
)
AS INSERT INTO dbo.news
(id,
title,
content
)
VALUES
(@id,
  @title,
  @content
)
GO

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog