Re: Please Help

From: oj (nospam_ojngo@home.com)
Date: 01/14/03


From: "oj" <nospam_ojngo@home.com>
Date: Mon, 13 Jan 2003 20:06:05 -0800


here is how to do it without dynamic sql...

e.g.
use master
go
declare @role sysname, @user sysname
select @role='db_datareader',@user='abc'

--create new sql login
exec sp_addlogin @user,@user
--grant access to pubs db
exec pubs..sp_adduser @user
--add to pubs datareader role
exec pubs..sp_addrolemember @role,@user
--see if the security is set
exec pubs..sp_helpuser @user

-- 
-oj
http://www.rac4sql.net
"David Lucus" <davidl@studentlife.tamu.edu> wrote in message
news:etA5uu0uCHA.2512@TK2MSFTNGP11...
> I have a stored procedure that adds new sql server accounts from the web.
> there are 2 databases that need teh login.  The database where the stored
> procedure resides has no problems granting roles and db access
permissions,
> however when i try to give it permissions to the other database nothing is
> happening.  It is not adding a user to the roles or throwing an error.
here
> is the code i am using to add the user to the second db
>
> EXECUTE  DBName.dbo.sp_grantdbaccess @newname
>
> EXECUTE  DBName.dbo.sp_addrolemember @sturolename, @newname
>
> where @newname is the variable with the name, and @sturolename is the role
> name.
>
> if anyone has any ideas please help.
>
> thx,
> David
>
>


Relevant Pages

  • Re: Full text catalog just not populating
    ... exec sp_defaultdb N'NT Authority\System', N'master' ... means either the network guys in my company who don't know SQL but are admins ... > needs this login to log into SQL Server and you can either add back this ... >> fetching U ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Indexing delay for one row.
    ... script and WAITFOR and varying the delay from 1 to 18 seconds. ... could you confirm your exact version of SQL Server that you are seeing ... It is possible that a change was made to the pooling frequence under SP3 to ... exec sp_fulltext_table 'FTSTable','create','FTSCatalog','FTSTable_IDX' ...
    (microsoft.public.sqlserver.fulltext)
  • Re: storing and searching office docs in SQL
    ... You CAN both store and search the contents of the MS Word ... files stored in an SQL Table's FT-enable IMAGE column, ... FTS CONTAINS or FREETEXT to search the contents of that MS word document: ... exec sp_fulltext_database 'enable' -- only do this once! ...
    (microsoft.public.sqlserver.programming)
  • Re: SqlDataAdapter1.SelectCommand.CommandType= CommandType.StoredProcedure
    ... > kann man beim EXEC PROC keine Parameter beifügen. ... CommandType.StoredProcedure wird intern als RPC Command abgesetzt, ... SQL RPC siehe SQL Server Dokumentation, ... nach der Ausführung ungültig werden. ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • pls help for the script!
    ... my script do not run with the parameter " ... exec sp_executesql @sql ... --Dummy-Tabelle Spaltenname erstellen ...
    (microsoft.public.de.vb.datenbank)