mercredi 31 décembre 2014

why does a space in a name in syslogins get treated like a wildcard?



USE [aDatabaseName]
GO

IF EXISTS (select * from sys.sysusers su join sys.syslogins sl
on sl.sid = su.sid where sl.name = N'XYZ\SQLBackup')

print ' dropping user from aDatabaseName'
DROP USER [XYZ\SQLBackup]

GO


The problem here is that the name in syslogins is actually XYZ\SQL Backup (note the space). Why would the select statement for XYZ\SQLBackup return a row for XYZ\SQL Backup?


When I run it it tells me that I can't drop user [XYZ\SQLBackup] because it doesn't exist. Which is certainly true.





Aucun commentaire:

Enregistrer un commentaire