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.
| Author |
Topic |
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-24 : 07:21:42
|
| Hi everyone,can any body tell meWhat is the difference between the followingCREATE proc test @Id as int, @value as varchar(10) = NULL, @outStatus as bit OUTPUTASSELECT @id, @value, @outstatusCREATE proc test1 @Id as int, @value as varchar(10), @outStatus as bit OUTPUTASSELECT @id, @value, @outstatusVaibhav T |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-03-24 : 07:26:58
|
the 2nd parameter @value in Stored Procedure test has a default value of NULL KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-24 : 08:07:57
|
| That means passing the argument @value in sp test is optionalis it like that ?Vaibhav T |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-24 : 11:47:55
|
quote: Originally posted by vaibhavktiwari83 That means passing the argument @value in sp test is optionalis it like that ?Vaibhav T
exactly. if you omit passing a value for that it will run with default value which is NULL------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-25 : 03:32:38
|
| And in order to force the variable to have default value, you should execute the procedure byEXEC test1 @id=some_value,@outStatus =some_valueMadhivananFailing to plan is Planning to fail |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-25 : 03:56:14
|
| Okey thanks to all.Vaibhav T |
 |
|
|
|
|
|
|
|