I'm currently creating a Multi-tenant data architecture in a SaaS BI-product.
The product are using shared database and shared schema, but with tenant view filters and tenant data encryption (Inspiration found here: http://msdn.microsoft.com/en-us/library/aa479086.aspx)
When creating the view filter, I can do both these:
CREATE VIEW TenantEmployees AS SELECT * FROM Employees WHERE TenantID = SUSER_SID() CREATE VIEW TenantEmployees AS SELECT * FROM Employees WHERE TenantID = SUSER_ID()
Using SID() I am using the Security Identifier that looks something like this:
Using ID() I am using the normal Identifier that looks something like this:
Which one is the absolute best to use and why? :) I expect that both are absolutely unique and will never be reused in newer user-logins