Sunday, July 1, 2012

Sql Procedure to Migrate Sql Database to higer version

Respected All,
               -> I have work to Migrate Sql server 2000 data base to Sql Server 2008 r2 .I had taken  backup of Sql Database from Sql Server 2000 and  restored  the backup  Database into Sql Server 2008 R2.

            ->After restoring i had used Count(*) query in Sql Server 2000 to find the total number of records in the table "Department" and it showed me total number of records in table "Department" as 96.

           ->I used same Count(*) query to find  total number of records in the table "Department" in Sql Server 2008 R2  and it showed me total number of records in table "Department" as 82 .

          ->Like this in all tables I am loosing records and in some tables it shows more records in Sql Server 2008 R2 when compared to Sql Server 2000. I had done R&D but i don't find any solution to i.e Suddenly i  had used  the below procedure in Sql Server 2008 r2 after restoring  and it executed and solved the problem .



   Syntax: 
             
USE DatabaseName;
GO
DBCC UPDATEUSAGE (DatabaseName)
GO

     example                       
USE DBC;
GO
DBCC UPDATEUSAGE (DBC)
GO