Skip to main content
added error
Source Link
Hakubex
  • 55
  • 1
  • 7

I am trying migrate databases and along with the database I am trying to also migrate the users without having to re-map the users. I was trying to recreate the windows user with the old server SID. Is this possible? I have an example of the code I have been trying to use but SQL does not like itgives me an incorrect syntax error.

Query:

USE [master]
GO
CREATE LOGIN [domain\ntuser] FROM WINDOWS 
WITH 
DEFAULT_DATABASE=[master],
SID=0x01000000000000000000000000000000000000000000000000000000;
GO

Error:

Msg 102, Level 15, State 1, Line 6
Incorrect syntax near '0x01000000000000000000000000000000000000000000000000000000'.

I am trying migrate databases and along with the database I am trying to also migrate the users without having to re-map the users. I was trying to recreate the windows user with the old server SID. Is this possible? I have an example of the code I have been trying to use but SQL does not like it.

USE [master]
GO
CREATE LOGIN [domain\ntuser] FROM WINDOWS 
WITH 
DEFAULT_DATABASE=[master],
SID=0x01000000000000000000000000000000000000000000000000000000;
GO

I am trying migrate databases and along with the database I am trying to also migrate the users without having to re-map the users. I was trying to recreate the windows user with the old server SID. Is this possible? I have an example of the code I have been trying to use but SQL gives me an incorrect syntax error.

Query:

USE [master]
GO
CREATE LOGIN [domain\ntuser] FROM WINDOWS 
WITH 
DEFAULT_DATABASE=[master],
SID=0x01000000000000000000000000000000000000000000000000000000;
GO

Error:

Msg 102, Level 15, State 1, Line 6
Incorrect syntax near '0x01000000000000000000000000000000000000000000000000000000'.
Source Link
Hakubex
  • 55
  • 1
  • 7

Can I create a new user in MS SQL from windows and provide the SID

I am trying migrate databases and along with the database I am trying to also migrate the users without having to re-map the users. I was trying to recreate the windows user with the old server SID. Is this possible? I have an example of the code I have been trying to use but SQL does not like it.

USE [master]
GO
CREATE LOGIN [domain\ntuser] FROM WINDOWS 
WITH 
DEFAULT_DATABASE=[master],
SID=0x01000000000000000000000000000000000000000000000000000000;
GO