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.
| 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 1Line 1: Incorrect syntax near ')'the line of code isEXEC 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??thankssteveAnd 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_USERGo with the flow & have fun! Else fight the flow |
 |
|
|
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 OptimizerTG |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-02-10 : 01:52:14
|
| Yup - can't pass expressions as arguments to SProcsKristen |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2005-02-15 : 02:27:09
|
| Thanks to all for the responses I'm now sortedsteveAnd 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. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-02-15 : 09:15:42
|
| as in "I'm now ordered by" ?! |
 |
|
|
|
|
|