您的位置:首页 > 其它

增加存储过程参数,确保调用老接口程序不出错

2005-09-05 15:48 405 查看
存储过程如果新增加参数.
让该参数使用默认值,
存储过程中根据默认值分支.以确保以前使用老的存储过程不出错

老存储过程

create procedure yaf_topic_save(
@PhotoFilmName varchar(50)=' ',
@PhotoCamera varchar(50)=' '
) as
begin
declare @TopicID bigint
declare @MessageID bigint

declare @Posted datetime
set @Posted = getdate()
if @ActionDate is null set @ActionDate = getdate()

insert into yaf_Topic(ForumID,Topic,UserID,Posted,Views,Priority,IsLocked,PollID,NumPosts,TopicMovedID,PhotoTypeID,PhotoFilmName,PhotoCamera,ActionDate)
values(@ForumID,@Subject,@UserID,@Posted,0,@Priority,0,@PollID,0,@TopicMovedID,@PhotoTypeID,@PhotoFilmName,@PhotoCamera,@ActionDate)

end 新存储过程

create procedure yaf_topic_save(
@PhotoFilmName varchar(50)=' ',
@PhotoCamera varchar(50)=' ',
@Posted datetime= null

) as
begin
declare @TopicID bigint
declare @MessageID bigint

if @Posted is null set @Posted = getdate()
if @ActionDate is null set @ActionDate = getdate()

insert into yaf_Topic(ForumID,Topic,UserID,Posted,Views,Priority,IsLocked,PollID,NumPosts,TopicMovedID,PhotoTypeID,PhotoFilmName,PhotoCamera,ActionDate)
values(@ForumID,@Subject,@UserID,@Posted,0,@Priority,0,@PollID,0,@TopicMovedID,@PhotoTypeID,@PhotoFilmName,@PhotoCamera,@ActionDate)

end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: