Re: A little help on a proc

From: Uri Dimant (urid_at_iscar.co.il)
Date: 02/07/05


Date: Mon, 7 Feb 2005 15:51:54 +0200

David
(untested)

CREATE PROC spSomething
@login VARCHAR(20)
AS
IF EXISTS(SELECT name FROM master..syslogins WHERE name =@login )
BEGIN
      DO something
ELSE
     PRINT 'A login does not exist'
END

GO
  "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: A little help on a proc
    ... I'm confuzzled about how to access the initial query throughout the ... >> create proc users ... >> David Lozzi ... If the login exists and the password is correct the third ...
    (microsoft.public.sqlserver.programming)
  • Permission to view system tables in master database
    ... I am trying to avoid the "Permission denied" error message when a proc tries ... Creating a proc that can view server state ... Master DB ... Create user for special login in the User DB ...
    (microsoft.public.sqlserver.security)
  • A little help on a proc
    ... I'm fairly new to the stored procedure world, I can create one to return a record set, look at me go. ... 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. ...
    (microsoft.public.sqlserver.programming)
  • 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)