IT Community - Software Programming, Web Development and Technical Support

Username and Password verification in SQL stored procedure.

This is a discussion on Username and Password verification in SQL stored procedure. within the Database Support forums, part of the Web Development category; Hi, I want to check whether the username and password are exists in the database or not using the Stored ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 12-23-2007, 08:41 PM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 632
oxygen is on a distinguished road
Default Username and Password verification in SQL stored procedure.

Hi,

I want to check whether the username and password are exists in the database or not using the Stored Procedure in SQL server. Can anyone give me an idea to do this.
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 12-23-2007, 08:43 PM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default Re: Username and Password verification in SQL stored procedure.

Hi,
Hope this helps..

CREATE PROCEDURE [trainee].[empinfologin]
(@username varchar(20), @password varchar(20), @values int output)
AS
declare @user varchar(20)
declare @pass varchar(20)
declare @result varchar(40)

BEGIN
select @user=username, @pass=password from empinfo
where username=@username and password=@password
if @user = @username and @pass = @password
begin
set @result='Success'
set @values=1
return @values
end
else
begin
select @user=username, @pass=password from empinfo where
username=@username
if @user=@username and @pass!=@password
begin
set @result='Incorrect Password'
set @values=2
return @values
end
else
SET @result='User does not exist'
set @values=3
return @values
end
END
__________________
S.Balasubramanian
Nothing is impossible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can we encrypt the username and password using PHP? sundarraja PHP Programming 3 05-15-2008 06:29 AM
stored procedure itbarota Database Support 3 03-10-2008 08:43 PM
how to get out parameter of stored procedure ? Murali PHP Programming 0 12-16-2007 03:57 AM
Can a stored procedure call itself or recursive stored procedure? How many level SP n H2o Database Support 1 08-03-2007 09:55 AM
Username,Password verfication in SQL Server 2005 itself using stored procedure oxygen Database Support 0 07-19-2007 11:21 PM


All times are GMT -7. The time now is 04:14 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0