Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Grant DB Access

Author  Topic 

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2010-08-17 : 09:19:00
Hi

I have users I am trying to add to the DB using the procedure:

sp_grantdbaccess N'User'
GO


But keep getting:

quote:
The procedure 'sp_grantDBAccess' cannot be executed within a transaction.


What does it mean within a transaction? How else can a piece of code be defined, is this not a transaction?

G

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2010-08-17 : 10:44:18
I was able to run the line with no problem...
which sql version are you using?

--------------------
keeping it simple...
Go to Top of Page

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2010-08-17 : 11:47:16
2000!
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-08-17 : 14:01:53
works for me too. are you sure you're not executing any other code?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-08-17 : 21:44:12
exactly as what the error message says, you can't execute the sp_grantdbaccess inside a transactions like

BEGIN TRAN

exec sp_grantdbaccess N'User'

COMMIT


move the sp_grantdbaccess to outside of the BEGIN TRAN .. COMMIT section


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2010-08-18 : 05:39:20
I've not got:

begin trans

commit

Even running like this:

exec sp_grantdbaccess N'User'
GO


Doesn't work, I get the same error.

Any other ideas?

Thanks

G
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2010-08-18 : 06:02:09
run the query on another window...you might have an open transaction on that session



--------------------
keeping it simple...
Go to Top of Page

aravindt77
Posting Yak Master

120 Posts

Posted - 2010-08-18 : 08:03:00
whether the logged in user have the right to grant access ??
Go to Top of Page
   

- Advertisement -