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 Programming
 SQL2005 User id naming issue?

Author  Topic 

IKON
Starting Member

3 Posts

Posted - 2006-12-07 : 15:33:51
Hey all

Am using SSMS to add users to a DB and here is an issue I cant conquer.

User id's in this format "Aname" work as designed
User Id's in this format "John P User" will not be recognized by ssms as valid windows user names even though "John P User" is Administrator of the local computer or even Domain Administrator. I have tried a script to enter the name and still the multiname format errors out where the normal naming format works every time..

Im new to the forum and very green in this arena, I have scanned 43 pages looking for a similar issue and have found nothing even remotely similar in a post.

I would be thankful for any bones you wise people could throw my way.

Best: Phil

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2006-12-07 : 16:52:11
quote:
Originally posted by IKON

I have tried a script to enter the name and still the multiname format errors out where the normal naming format works every time..

Post the script that you tried.

STAR SCHEMAS ARE NOT DATA WAREHOUSES!
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-12-07 : 21:27:55
were you by any chance adding a sql login as using windows authentication?

or it might be server collation problem

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

IKON
Starting Member

3 Posts

Posted - 2006-12-08 : 09:10:52
Sample of the script I am using:

osql -E -S .\Company2 -C -Q "sp_grantlogin '%1'
osql -E -S .\Company2 -d DBinstance -Q "sp_grantdbaccess '%1'"
osql -E -S .\Company2 -d DBinstance -Q "sp_addrolemember 'db_owner', '%1'"

Again a WA user name of "juser" works as designed,
But a WA user name of John p user" errors with the script and the ssms tool as well..

Thanks Phil
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2006-12-08 : 16:18:51
Phil,

Try changing '%1' to '[%1]'. The brackets may eliminate the problem with the spaces in the user name (like they do with spaces in table/column names or reserved words used as column names).

Ken
Go to Top of Page

IKON
Starting Member

3 Posts

Posted - 2006-12-14 : 09:08:10
quote:
Originally posted by KenW

Phil,

Try changing '%1' to '[%1]'. The brackets may eliminate the problem with the spaces in the user name (like they do with spaces in table/column names or reserved words used as column names).

Ken



Thanks Ken
Testing it now..
Phil
Go to Top of Page
   

- Advertisement -