| Author |
Topic |
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2007-03-01 : 00:12:41
|
| hi, this is my spc:CREATE PROCEDURE HRLogin_splogincheck(@username varchar(50),@password varchar(50))Asbeginselect count(*) as count,user_name from usermaster group by user_name where userid=@username and password=@password endGO i am getting error,i thind i made some mistake in query,can any one please help me to rectify the error please |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-01 : 00:16:14
|
[code]CREATE PROCEDURE HRLogin_splogincheck(@username varchar(50),@password varchar(50))Asbeginselect count(*) as count, user_name from usermaster where userid = @username and password = @passwordgroup by user_name endGO[/code] KH |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2007-03-01 : 00:26:32
|
| thank you khtan i got it. |
 |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-03-01 : 01:46:44
|
| Hi, sqllover;sorry but can you give me an example of what you wud use that sp for?am very very new to this. Ll appreciate. |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2007-03-01 : 03:32:04
|
| hi jsinks canu explain clearly so that i can help you |
 |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-03-01 : 04:54:47
|
| I meant to say what does this procedure do? How can you use it? gve an example maybe |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2007-03-01 : 04:59:29
|
| hi, i am doing this for login validation and getting user_name for other purpose.if count=0 means invalid username, count=1 means valid username. |
 |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-03-01 : 06:18:48
|
| ok, thanks. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-01 : 08:03:22
|
quote: Originally posted by sqllover hi, i am doing this for login validation and getting user_name for other purpose.if count=0 means invalid username, count=1 means valid username.
If sole purpose of this SP is to check the existence of user name, IF EXISTS will perform better than GROUP BY.IF EXISTS(Select * from usermaster where userid = @username and password = @password) -- User Name found Select 1Else -- User name not found Select 0 Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|