varbinary column removes zeroes on objectSid

Nov 20, 2012 at 11:28 AM
Edited Nov 20, 2012 at 11:29 AM

When I'm trying to add an entry netsqlazman_ApplicationGroupsTable I provide objectSid that is generated by SqlAzManSID.NewSqlAzManSid(). Sometimes the guid that is generated ends with two zeroes or more and when adding to database column varbinary(85) the zero is removed by the database. When loading the same sid I get only 15 bytes instead of 16 (zero was removed) - that causes an exception.

Any reason for this particular column not to be binary(16) instead of varbinary(85)?

(that fixes the problem)

 

azman version 3.6.0.15

sql server 2008R2

Coordinator
Nov 20, 2012 at 11:43 AM

Hi,

I chose to use the varbinary(85), because the default SQL server functions (SUSERSID and SUSERNAME) wants just a varbinary(85) to represent SIDs parameters.

A binary(16) would not be sufficient in special cases (i.e. AD forests).

However, this behavior is modeled by the ANSI_PADDING SQL Server variable (ON or OFF).

See here for more information: http://msdn.microsoft.com/en-us/library/ms187403.aspx 

Regards,
Andrea.