Uma Sankar Redd...'s profileSankar Reddy's sql spacePhotosBlogListsMore ![]() | Help |
|
September 23 Database Internal version; Create Version and Current VersionSQL Server has versions, editions, service packs, compatibility levels and Internal versions. Most of the people know about the first 4 and if you are wondering about what is the database internal version then you should look at Database Version vs Database Compatibility Level post by Jonathan Kehayias and Technet Q&A article by Paul Randal. Here is a script I wrote to look at what’s the create and current internal database version of all databases. This might be handy if you have to look at multiple databases on different servers. CREATE TABLE #version ( VersionID INT , VersionName VARCHAR(255) ) INSERT #version SELECT 515, 'SQL Server 7.0' UNION ALL SELECT 539, 'SQL Server 2000' UNION ALL SELECT 611, 'SQL Server 2005, VARDECIMAL disabled' UNION ALL SELECT 612, 'SQL Server 2005, VARDECIMAL enabled' UNION ALL SELECT 655, 'SQL Server 2008' UNION ALL SELECT 660, 'SQL Server 2008 R2' CREATE TABLE #DBCC ( ParentObject VARCHAR(255) , [Object] VARCHAR(255) , Field VARCHAR(255) , [Value] VARCHAR(255) ) CREATE TABLE #DBCCResults ( ServerName VARCHAR(255) , DBName VARCHAR(255) , VersionCreated INT , CurrentVersion INT , CreatedDate DATETIME ) EXEC master.dbo.SP_MSFOREACHDB @Command1 = 'USE ? INSERT INTO #DBCC EXECUTE (''DBCC DBINFO WITH TABLERESULTS'')' , @Command2 = 'INSERT INTO #DBCCResults (ServerName, DBName, VersionCreated, CurrentVersion, CreatedDate) SELECT TOP 1 @@SERVERNAME , ''?'' , (SELECT Value FROM #DBCC WHERE Field = ''dbi_createVersion'') , (SELECT Value FROM #DBCC WHERE Field = ''dbi_version'') , (SELECT Value FROM #DBCC WHERE Field = ''dbi_crdate'') FROM #DBCC' , @Command3 = 'TRUNCATE TABLE #DBCC' SELECT ServerName , DBName , v1.VersionName AS VersionCreated , v2.VersionName AS CurrentVersion , CreatedDate FROM #DBCCResults dr JOIN #version v1 ON dr.VersionCreated = v1.VersionID JOIN #version v2 ON dr.CurrentVersion = v2.VersionID DROP TABLE #version, #DBCC, #DBCCRESULTS TrackbacksThe trackback URL for this entry is: http://sankarreddy.spaces.live.com/blog/cns!1F1B61765691B5CD!463.trak Weblogs that reference this entry
|
|
|