Re: A little help on a proc
From: Keith Kratochvil (sqlguy.back2u_at_comcast.net)
Date: 02/07/05
- Next message: Hugo Kornelis: "Re: Can this be done using TSQL ??!!"
- Previous message: Keith Kratochvil: "Re: A little help on a proc"
- In reply to: David Lozzi: "Re: A little help on a proc"
- Next in thread: David Lozzi: "Re: A little help on a proc"
- Reply: David Lozzi: "Re: A little help on a proc"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Feb 2005 08:48:25 -0600
You can do anything you want. Do you care if the loginname is invalid? Do
you care if the password is invalid? Or do you just want a "Yes,
authentication passed -- here is your data" or an "Authentication Failed"
notification?
-- Keith "David Lozzi" <dlozzi@(remove-this)delphi-ts.com> wrote in message news:e8kNiGSDFHA.560@TK2MSFTNGP15.phx.gbl... > So the best process is to rerun the query? Wouldnt that get extensive for > the server? Can I run something like this: > > create proc users > @Fullname VARCHAR Output, @Security Integer OUTPUT, etc. > > Run query that verifies username > if username valid > check password against previously returned recordset > if password valid > @fullname = returned data, @security, etc. > else > return 2 > else > return 1 > end > > > By the way, i'm accessing this from an ASP.NET page. > > -- > David Lozzi > Web Applications/Network Specialist > Delphi Technology Solutions, Inc. > dlozzi(remove-this)@delphi-ts.com > > > "Keith Kratochvil" <sqlguy.back2u@comcast.net> wrote in message > news:eMvhnASDFHA.2632@TK2MSFTNGP12.phx.gbl... > > This should get you started: > > > > create proc foo as > > @loginname varchar(20), > > @password varchar(50) > > as > > > > --verify that the login is valid > > if not exists (select * from sometable where somelogincolumn = @loginname) > > BEGIN > > RETURN (1) > > END > > > > --verify that the password is valid > > if not exists (select * from sometable where somelogincolumn = @loginname > > AND somepasswordcolumn = @password) > > BEGIN > > RETURN (2) > > END > > > > select somecolumn > > from sometable > > where somelogincolumn = @loginnamae > > and somepasswordcolumn = @password > > RETURN (0) > > GO > > > > The return code will be 1 if the login does not exist, 2 if the password > > is > > not correct. If the login exists and the password is correct the third > > statement will be executed and the return code will be set to 0. > > > > -- > > Keith > > > > > > "David Lozzi" <dlozzi@(remove-this)delphi-ts.com> wrote in message > > news:eShjWtRDFHA.512@TK2MSFTNGP15.phx.gbl... > > I'm fairly new to the stored procedure world, I can create one to return a > > record set, look at me go. However, I need to get a little more advanced. > > I > > need to do the following in a proc: > > > > Query a honken huge query and check if login is valid. If so, continue > > through proc and return the necessary data, if not return an invalid > > status. > > > > Thanks a million!! > > > > > > -- > > David Lozzi > > Web Applications/Network Specialist > > Delphi Technology Solutions, Inc. > > dlozzi(remove-this)@delphi-ts.com > > > > > >
- Next message: Hugo Kornelis: "Re: Can this be done using TSQL ??!!"
- Previous message: Keith Kratochvil: "Re: A little help on a proc"
- In reply to: David Lozzi: "Re: A little help on a proc"
- Next in thread: David Lozzi: "Re: A little help on a proc"
- Reply: David Lozzi: "Re: A little help on a proc"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|