You must Sign In to post a response.
  • Category: SQL Server

    Migration from SQL server 2008 R2 to 2012

    How to upgrade a database from SQL server 2008 r2 to SQL server 2012. what are the new features do i implement and how?
    Give me some examples
  • #758115
    Hi Sivs,


    Go to SQL Server Installation Center and Chose the first option..

    Refer the below link for Migrating SQL Server 2008 to 2012:
    http://sqlmag.com/sql-server-2012/migrating-sql-server-2012

    This will help you for sure with step by step

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #758118
    I am asking how to migrate a database from SQL server 2008 r2 to SQL server 2012

  • #758123
    Hi Sivs,

    Refer the below link :
    https://msdn.microsoft.com/en-us/library/ms189625.aspx

    You can use the below code also:
    ALTER DATABASE MyDatabase SET COMPATIBILITY_LEVEL = 110;

    DECLARE @SQL NVARCHAR(MAX) = N'';

    Declare @Tables table
    ([Schema] nvarchar(50)
    ,[TableName] nvarchar(100))

    Insert into @Tables
    Select QUOTENAME(SCHEMA_NAME(schema_id)),QUOTENAME(name)
    FROM sys.tables;

    Declare @Schema nvarchar(50), @TableName nvarchar(100)

    While Exists(Select * From @Tables)
    Begin
    Select Top 1 @Schema = [Schema], @TableName = [TableName] From @Tables
    Set @SQL = 'UPDATE STATISTICS ' + @Schema + '.' + @TableName + ' WITH FULLSCAN;'

    Begin Try
    EXEC SP_ExecuteSql @SQLToExecute = @SQL
    Print 'Completed: ' + @SQL
    End Try
    Begin Catch
    DECLARE @ErrMsg nvarchar(4000)
    SELECT @ErrMsg = SubString(ERROR_MESSAGE(),0,900)

    Select GetDate(), 'Failed updating stats on ' + @Schema + ' ' + @TableName + '. Error: '+@ErrMsg
    End Catch

    Delete From @Tables Where [Schema] = @Schema and [TableName] = @TableName
    End

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


  • Sign In to post your comments