sql server 2005 - Stored Procedure in SQLServer user login -


I write the process for logging where users can send usernames or e-mails for login and password. My process is like this: Process users_login (@ Username varchar (50), @ password varchar (50), @ melith varchar (50), @ ret int output) password, e- Mail, where user name = isnull (@username, blank) or emailid = isnull (@mailid, null) and [password] = @password (@@ rowcount> 0) set @rate = 1 end set and otherwise Start Set @ rate = 0 End End

Is it OK or Amendment

There is a problem in the query itself, you have to bracket The statement must be placed around the or statement otherwise the statement will always return a line when the user name will have a match in the table: / pre>

Others should not save passwords in clear text Please read something like this

For the style, I personally They would not like this. As others have pointed out that isnull () in this case, it is similar to not using it. You can also reduce the use of @@ puncto ount by setting @ret to the selected statement. If it does not give a line then it will not be set so that it can achieve the same end.

Then I will write it:

process user_login (@ username varchar (50), @pavard wart (50), @ melith varchar (50), @inte art output ) Set @ rate = 0 as the @ rate = 1 users from where the user endorses (Username = isnull (user name, zero) or email = isnull (@ email, tap) and [password] = @ password

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -