Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 output parameter default value

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2009-02-19 : 18:36:43
Hi,

I am modifying one of my SPROCS in the effort of reducing my web apps round trips to the database.

Is it not possible to set a default value for OUTPUT params?

I keep getting NULL back.. any help appreciated !!

Thanks again :)
mike123

create PROCEDURE [dbo].[insert_newUser_quick_NEW]
(
@NameOnline [varchar](15),
@NameFirst [varchar](20) = NULL,
@NameLast [varchar](20) = NULL,
@EmailAddress [varchar](50),
@GenderID [tinyint],
@IP [varchar](15),

@email_Available [tinyint] OUTPUT,
@nameOnline_Available [tinyint] OUTPUT
)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-19 : 18:37:58
You would do that in the body of the stored procedure.

SET @yourOutVar = <default value>

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2009-02-19 : 18:46:58
ok great,

is there any difference between these ?


SELECT @email_Available = 1
SELECT @nameOnline_Available = 1

or


SET @email_Available = 1
SET @nameOnline_Available = 1

thanks again! :)
mike123
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-19 : 19:05:50
SELECT allows you to do them at the same time. With SET, you can only do them one at a time.

SELECT @email_Available = 1, @nameOnline_Available = 1

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -