成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術文章
文章詳情頁

SQL server 2000存儲過程

瀏覽:132日期:2023-11-01 13:20:21

if exists(select name from sysobjects where name='GetRecord' and type = 'p') drop procedure GetRecordGO

create procedure GetRecord@id int output,;;;--輸出p_id和p_path@path nvarchar(255) outputas

select top 1 @id = p_id, @path = p_path from n_project where p_flag = '0'; if(@id > 0) Update n_project set p_flag = '1' where p_id = @idelse begin set @id = 0;;;;--若沒有結果則給個默認值,否則直接返回NULL會使程序錯誤 set @path = ' '--若p_path為NULL,則它也會返回NULL,從而造成程序錯誤 endif(@path is NULL)begin set @path = ' ';end

if @@error=0 print 'Good'elseprint 'Fail'go

--測試程序declare @idd intdeclare @ppath nvarchar(255)EXEC dbo.GetRecord @idd output,@ppath outputselect '1'=@idd, '2'=@ppathgo

SQL SERVER中,按CTR+0,即可輸入空值NULLhttp://blog.csdn.net/gzq400/archive/2007/02/02/1501235.aspx