增加存储过程参数,确保调用老接口程序不出错
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
让该参数使用默认值,
存储过程中根据默认值分支.以确保以前使用老的存储过程不出错
老存储过程
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
相关文章推荐
- java程序调用存储过程得到新增加记录的id号的方法
- 存储过程接口参数增加的解决
- asp程序调用SQL Server的存储过程,获取不到输出参数的值
- java程序调用有参存储过程返回参数
- asp程序调用SQL Server的存储过程,获取不到输出参数的值
- 【Mybatis】MyBatis调用带有返回结果、output参数的存储过程上与ibatis的区别
- C#带输出参数的存储过程调用
- C#调用Oracle的存储过程,其参数为数组类型
- Oracle中调用带有返回参数的存储过程
- 【ASP.NET开发】ADO.NET调用带输出参数的存储过程 分类: ASP.NET 2012-09-10 21:16 1261人阅读 评论(1) 收藏
- 带输出参数的存储过程的定义,以及在aso.net中调用
- 存储过程输出参数:C#中调用输入输出参数的存储过程
- gdb调试运行程序带参数(调用动态链接库),debug过程记录
- java结构化参数调用存储过程
- C# 调用SQL的存储过程的接口及实现
- Oracle存储过程及其java程序调用
- dblink远程库表结构修改导致本地库调用此表的存储过程出错问题解决方法
- mysql 创建存储过程 java程序调用该存储过程
- C#调用SQL中的存储过程中有output参数,存储过程执行过程中返回信息
- 低权用户调用高权用户创建的存储过程出错:noAccessToProcedureBodies