SQL Statement for Inserting Authorizatoins

Topics: General Topic
Aug 15, 2013 at 11:20 PM
I have a need to write a SQL statement for one time migration of data from an old system into our current database. I have migrated the Users but now need to get their roles inserted into NetSQLAzman.

I started with the following SQL Statement:

INSERT INTO [dbo].[netsqlazman_AuthorizationsTable] ([ItemId], [ownerSid], [ownerSidWhereDefined], [objectSid], [objectSidWhereDefined], [AuthorizationType], [ValidFrom], [ValidTo])
SELECT UserSystemRole.RoleLkpID, CONVERT(VARBINARY(85), 'ownerid?'), 2, CONVERT(VARBINARY(85), [User].UserID) as sid, 4, 1, NULL, NULL
                  UserSystemRole ON [User].UserID = UserSystemRole.UserID
Am I doing this right? I am not sure what to put for the ownerSID. Would it be my domain/username like this 'HostingDomain\Myusername'

Any assistance that you can provide will be greatly appreciated.