Login errors please help asap..............

  • I am running a job with the below script and i get an error. if someone can help me asap please

    USE [APPLETTS]

    GO

    CREATE USER [IBM\Pratck] FOR LOGIN [IBM\Pratck]

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_datareader'', N''IBM\Pratck''

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_datawriter'', N''IBM\Pratck''

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_ddladmin'', N''IBM\Pratck''

    GO

    USE [APPLETTS]

    GO

    CREATE USER [IBM\Sfoxie] FOR LOGIN [IBM\Sfoxie]

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_datareader'', N''IBM\Sfoxie''

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_datawriter'', N''IBM\Sfoxie''

    GO

    USE [APPLETTS]

    GO

    CREATE USER [IBM\bratt] FOR LOGIN [IBM\bratt]

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_datareader'', N''IBM\bratt''

    GO

    USE [APPLETTS]

    GO

    EXEC sp_addrolemember N''db_datawriter'', N''IBM\bratt''

    GO

    sp_change_users_login @Action=''update_one'', @UserNamePattern=''tsmith'', @LoginName=''tsmith''

    exec sp_change_users_login ''Auto_Fix'', ''IBM\kkite''

    exec sp_change_users_login ''Auto_Fix'', ''IBM\102009sara''

    errors that i get are :-------------

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_datareader'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_datawriter'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_ddladmin'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_datareader'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_datawriter'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_datareader'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'db_datawriter'.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'update_one'.

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near 'Auto_Fix'.

    Msg 102, Level 15, State 1, Line 5

    Incorrect syntax near 'Auto_Fix'.

    any help is appreciated............

  • any idea friends what's going out in the script

  • You may have other syntax errors but from Books On Line.

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/01de7476-4b25-4d58-85b7-1118fe64aa80.htm

    The names of users that are mapped to SQL Server logins, certificates, or asymmetric keys cannot contain the backslash character (\).

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • where you see the \ is the windows authenticated user.

  • you are doubling the quotes

    when you have got

    EXEC sp_addrolemember N''db_datareader'', N''IBM\Pratck''

    replace it with

    EXEC sp_addrolemember N'db_datareader', N'IBM\Pratck'

    do that for all of the lines that error and you will be fine

    you can have a \ in the user name if it is a domain account

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply