December 5, 2011 at 3:01 am
Hello Everyone,
Please help me.
I want to create a procedure which will take output parameter nullable. Is there anyway to do this?
Thanks in Advance.
December 5, 2011 at 3:14 am
Here is one way of doing so, but I have to admit that I don’t like to use an output parameter and pass values to it into the procedure. The fact that it does work doesn’t always mean that we should use it
create procedure DemoProc (@MyOutputVar int =null output)
as
select @MyOutputVar
go
declare @i int
set @i = 10
--Not passing anything
exec DemoProc
--Passing null as constant
exec DemoProc null
--Passing the vairiable
exec DemoProc @i
go
drop proc DemoProc
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
December 5, 2011 at 4:17 am
Thanks Adi
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply