| Author |
Topic  |
|
|
julius.delorino
Starting Member
Philippines
29 Posts |
Posted - 06/07/2012 : 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 OUTPUT set Param3 =0
if( select var1,var2 from table where var1=@param1 and var2 =@param2) set @param3 =1 else Set @Param3 =0
how can you write this on a stored procedure,i hope you can help me guys thank i advance,more power SQLTEAM.
|
|
|
nigelrivett
Flowing Fount of Yak Knowledge
United Kingdom
3328 Posts |
Posted - 06/07/2012 : 08:15:32
|
create proc x @Param1 nvarchar(10),@Param2 nvarchar(20),@Param3 int OUTPUT as if exists (select * from table where var1=@param1 and var2 =@param2) select @param3 =1 else select @Param3 =0 go
========================================== 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
Philippines
29 Posts |
Posted - 06/07/2012 : 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 pass 2 parameters from vb.net then the stored procedure will process if the parameters passed is equal to the selected data from table, if equal then return 1 else return 0. that kind of logic in writing stored procedure what i am looking for,but thanks for your help sir. |
 |
|
|
nigelrivett
Flowing Fount of Yak Knowledge
United Kingdom
3328 Posts |
Posted - 06/07/2012 : 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. |
 |
|
| |
Topic  |
|