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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored procedure for login

Author  Topic 

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-23 : 08:40:47
I have two tables for User table and member table i want a stored procedure that will chack if its user or a member who login

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-23 : 08:47:17
[code]CREATE PROC GetUserDetails
@UserID
AS
SELECT *
FROM Users u
INNER JOIN Member m
ON m.UserID=u.UserID
WHERE u.UserID=@UserID
GO[/code]
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-23 : 08:48:34
SELECT UserName, Password, x
FROM (
SELECT UserName, Password, 'user' as x FROM User
UNION ALL
SELECT UserName, Password, 'member' FROM Member
) AS d
WHERE UserName = @UserName AND Password = @Password



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-23 : 09:15:32
But my problem is in the member table the username is column is namew as Surname.
quote:
Originally posted by Peso

SELECT UserName, Password, x
FROM (
SELECT UserName, Password, 'user' as x FROM User
UNION ALL
SELECT UserName, Password, 'member' FROM Member
) AS d
WHERE UserName = @UserName AND Password = @Password



E 12°55'05.63"
N 56°04'39.26"


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-23 : 09:17:37
Then show your strructures and illustrate what result you want.
Go to Top of Page

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-23 : 09:25:37

User table
{
Username varchar(30),
Password varchar(30),
Name varchar(30),
Surname varchar(30)

}
member table
{
MemberName varchar(30),
Surname varchar(30),
Id int=0 ;
MemberNo int=0;
}
the when the user login he use username and password and the member use Surname and Memberno.
quote:
Originally posted by visakh16

Then show your strructures and illustrate what result you want.

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-24 : 00:58:47
Use my query and substitute the column names and table names with your real column names.
It can't be that hard, can it?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-09-24 : 01:38:33
When you say member are you using .net's inbuilt membership provider ?
Go to Top of Page
   

- Advertisement -