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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Bracket Schmacket

Author  Topic 

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2005-02-04 : 06:10:30
This is only for testing purposes but when I try the following I get the error

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ')'

the line of code is

EXEC sp_addrolemember 'MY_Admin', GET_USER()


All I want to do is to (temporarily) put the login that the script is being run through into this particular group (may or may not be me) so that I can test it.

Does this make sense? Does the error make sense? I've tried CURRENT_USER, USER and any other combination I can think of.

Anyone have any clues??

thanks

steve

And how is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-04 : 06:42:02
you mean:
select user_name(), CURRENT_USER


Go with the flow & have fun! Else fight the flow
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-02-04 : 07:58:55
I think sp_addrolemember doesn't like a function passed as an argument a parameter. You need:

declare @membername varchar(50)
Select @membername = user_name()
exec sp_addrolemember 'my_admin', @membername



Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-02-10 : 01:52:14
Yup - can't pass expressions as arguments to SProcs

Kristen
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2005-02-15 : 02:27:09
Thanks to all for the responses I'm now sorted

steve

And how is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-02-15 : 09:15:42
as in "I'm now ordered by" ?!
Go to Top of Page
   

- Advertisement -