December 29, 2008 at 7:11 pm
Hi All,
I want to write a script which can work on both SQL 2000 and SQL 2005, the SQL 2000 Script is given below
select @@servername,b.name,a.name
from master.dbo.spt_values a, master.dbo.sysxlogins b
where a.low = 0
and a.type = 'SRV'
and b.srvid IS NULL
and a.number & b.xstatus = a.number
As you know Sysxlogins is not present in SQL Server 2005.
Please help.
Thanks in Advance.
Regards,
Raj
December 29, 2008 at 8:32 pm
The syslogins view is the common view between them. Otherwise, you need to check the server version and have two distinct code blocks. I have different code blocks in a few of my management procedures that are common between servers where functionality is different between versions.
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
December 29, 2008 at 8:39 pm
Hi Jonathan,
Thanks for the reply, but from which table I can find xstatus in SQL Server 2005.
Regards,
Raj
December 29, 2008 at 8:40 pm
I don't know of one. The syslogin view has a column for each of the server roles that is a bit field in both 2000 and 2005, so you don't have to do a join to find out what roles a login has been granted.
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
December 30, 2008 at 3:53 am
What exactly you want to pull out using this code?
MJ
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply