CREATE LOGIN fails with NT authenticated logins

maukemanmaukeman Posts: 4
edited July 14, 2006 12:27PM in SQL Packager Previous Versions
Packager qualifies NT authenticated user names like "ServerA\LoginName" when it creates a package. The package fails when running on ServerB because it cannot authenticate ServerB\LoginName. Is there any way to work around this problem? Does packager only work on computers in the same Domain ?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    SQl Packager scripts the login exactly as it was on the source server. What you'd need to do is omit all users from the package, then manually create them in a SQL script that you can run immediately before executing the package, such as this one for SQL 2005:
    DECLARE @netname nvarchar(20)
    
    DECLARE @command nvarchar(256)
    
    EXEC xp_getnetname @netname OUTPUT
    
    SELECT @command='CREATE LOGIN ['+@netname+'\ASPNET] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]'
    
    exec sp_executesql @command
    
    SELECT @command=CREATE USER [ASPNET] FOR LOGIN [' +@netname+'\ASPNET] WITH DEFAULT_SCHEMA=[dbo]'
    
    exec sp_executesql @command
    
Sign In or Register to comment.