Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: How can I add user from Query Analyzer


Message #1 by "Alaa Salmo" <salmo@i...> on Fri, 1 Jun 2001 15:05:41
I'm sorry, i dont understand what you're asking.

Do you want to know if you can write a stored procedure that calls this system proc?
 If so, then, yes - you could create stored procedure that took the same parameters
as the sp_AddUser and then, in your stored proc execute the sp_AddUser proc.  It
might look like this:

CREATE PROCEDURE sp_MyAddSystemUser (@UserName varchar(50), @DBName varchar(20) 
"", @RoleName varchar(20) = "" )

AS

--do any other sort of logic here
 
DECLARE @rv int
 
EXEC @rv = sp_AddUser @UserName, @DBName, @RoleName
 
RETURN @rv

that will return the resulting code from the sp_adduser proc.  you could also
examine this yourself in the proc and return a custom error number, if you want.

i hope this is what you're looking for.

john

--- Alaa Salmo <salmo@i...> wrote:
> Thank you for your response.
> Please can you tell me if  I want to implement this in the procedure
> 
> Thank you again
> 
> Alaa Salmo
> 
> -----Original Message-----
> From: John Pirkey [mailto:mailjohnny101@y...]
> Sent: Friday, June 01, 2001 9:43 AM
> To: sql language
> Subject: [sql_language] Re: How can I add user from Query Analyzer
> 
> 
> try this:
> 
> USE <Your database name>
> GO
> 
> EXEC sp_AddUser 'YourName', 'optional name in db', 'optional role/group name
> to be a
> part of'
> 
> 
> that should do it.
> 
> john
> 
> --- Alaa Salmo <salmo@i...> wrote:
> > Hi
> > I need your help.
> > I want to create user from Query Analyzer and I want to give this user
> > access to specific database (I have this database in my system).
> > Can you provide me with example.
> >
> > Thank you
> >
> > Alaa Salmo
> 
> ----------------------------
> John Pirkey
> MCSD
> John@S...
> http://www.stlvbug.org
> 
> 


  Return to Index