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)
 Parameter default value

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-02-09 : 16:58:14
Hello,

I am creating an output parameter with default value as follows:
@Feedback INT = 0 OUTPUT

However this is not working.

Am I doing something wrong?

Thanks,
Miguel

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-02-09 : 17:12:11
A default value is for input parameters. Your @Feedback is actually an input and an output parameter. So if at the top of your stored procedure you put PRINT @Feedback, you should see a zero displayed.

Tara Kizer
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-02-09 : 17:16:28
I didn't understand very well.

Basically in my procedure code I have various IF's which set the value of feedback to 1,2,3,4, etc.
So when none of the IF's conditions is verified the default value would be returned, i.e. 0.

Of course I could use ELSE but I would like to set an initial value in the begining.

Is this possible?

Thanks,
Miguel
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-02-09 : 17:22:57
To make it short, you must use ELSE. You can't do what you want via a default value.

Tara Kizer
Go to Top of Page
   

- Advertisement -