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 |
julius.delorino
Starting Member
29 Posts |
Posted - 2012-06-07 : 08:05:31
|
sir i have this problem on how to write this effectively on stored procedure;Declare @Param1 nvarchar(10),@Param2 nvarchar(20),@Param3 int OUTPUTset Param3 =0if(select var1,var2 from table where var1=@param1 and var2 =@param2)set @param3 =1elseSet @Param3 =0how can you write this on a stored procedure,i hope you can help me guys thank i advance,more power SQLTEAM. |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-06-07 : 08:15:32
|
create proc x@Param1 nvarchar(10),@Param2 nvarchar(20),@Param3 int OUTPUTasif exists (select * from table where var1=@param1 and var2 =@param2)select @param3 =1elseselect @Param3 =0go==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
julius.delorino
Starting Member
29 Posts |
Posted - 2012-06-07 : 08:22:37
|
thanks for your reply, but not the output that i wanted,but thanks anyway. i am writing a simple login script in which i will pass2 parameters from vb.net then the stored procedure will processif the parameters passed is equal to the selected data from table,if equal then return 1 else return 0. that kind of logic in writingstored procedure what i am looking for,but thanks for your help sir. |
 |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-06-07 : 08:36:02
|
That takes the two parameters. If there is a row in the table that matches it returns 1 else 0.That's sounds like what you want?==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|