Re: A little help on a proc

From: David Lozzi (dlozzi_at_(remove-this)delphi-ts.com)
Date: 02/07/05


Date: Mon, 7 Feb 2005 09:57:23 -0500

I guess, I'm confuzzled about how to access the initial query throughout the
rest of the proc?

-- 
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:O3oE6RSDFHA.3452@TK2MSFTNGP09.phx.gbl...
> 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
>> >
>> >
>>
>>
> 


Relevant Pages

  • RE: Using query values for field name in table
    ... "Proc" is a caption given to acalculated field in the query ... should fldName be defined as a string variable which I can then ... >> Dim dbsGeneralThoracic As Database ...
    (microsoft.public.access.modulesdaovba)
  • Re: A little help on a proc
    ... David Lozzi ... PRINT 'A login does not exist' ... I need to do the following in a proc: ... Query a honken huge query and check if login is valid. ...
    (microsoft.public.sqlserver.programming)
  • Re: A little help on a proc
    ... So the best process is to rerun the query? ... > create proc foo as ... > The return code will be 1 if the login does not exist, ... > record set, look at me go. ...
    (microsoft.public.sqlserver.programming)
  • Re: A little help on a proc
    ... PRINT 'A login does not exist' ... I'm fairly new to the stored procedure world, I can create one to return a record set, look at me go. ... I need to do the following in a proc: ... Query a honken huge query and check if login is valid. ...
    (microsoft.public.sqlserver.programming)
  • Re: A little help on a proc
    ... but how do I now access that recordset if it exists? ... David Lozzi ... PRINT 'A login does not exist' ... I need to do the following in a proc: ...
    (microsoft.public.sqlserver.programming)