Ошибка specified cast is not valid sqlmanagerui

I am using SQL Server 2008 R2 Standard (version 10.50.1600.1) for my production website and
SQL Server Express edition with Advanced Services (v10.50.1600.1) for my localhost as a database.

Few days back my SQL Server crashed and I had to install a new 2008 R2 Express version on my localhost. It worked fine when I restored some older versions taken from Express edition but when I try to restore database from .bak file which is taken from production server it is causing the following error:

Error: Specified cast is not valid. (SqlManagerUI)

and when I try to restore the database using command

Use Master
Go
RESTORE DATABASE Publications
FROM DISK = 'C:\Publications.bak'
WITH MOVE 'Publications' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.mdf',--adjust path
MOVE 'AlPublications_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.ldf'

It generates a different error

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing ‘Publications’ database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

I have cross checked the versions. They all seem matching to me as shown in the image below

Previously I was able to restore a database from standard version to express edition but now it fails. I deleted the database and tried to recreate it. That fails, too.

I am not sure what I am doing wrong. I would appreciate help in this regarding

Issue was resolved as it seems .bak file was corrupt. When I tried it with a different file it worked.

I am using SQL Server 2008 R2 Standard (version 10.50.1600.1) for my production website and
SQL Server Express edition with Advanced Services (v10.50.1600.1) for my localhost as a database.

Few days back my SQL Server crashed and I had to install a new 2008 R2 Express version on my localhost. It worked fine when I restored some older versions taken from Express edition but when I try to restore database from .bak file which is taken from production server it is causing the following error:

Error: Specified cast is not valid. (SqlManagerUI)

and when I try to restore the database using command

Use Master
Go
RESTORE DATABASE Publications
FROM DISK = 'C:\Publications.bak'
WITH MOVE 'Publications' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.mdf',--adjust path
MOVE 'AlPublications_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.ldf'

It generates a different error

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing ‘Publications’ database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

I have cross checked the versions. They all seem matching to me as shown in the image below

Previously I was able to restore a database from standard version to express edition but now it fails. I deleted the database and tried to recreate it. That fails, too.

I am not sure what I am doing wrong. I would appreciate help in this regarding

Issue was resolved as it seems .bak file was corrupt. When I tried it with a different file it worked.

Summary

This Error Message Article explains the Microsoft SQL Server Management Studio error message “Specified cast is not valid. (SqlManagerUI)” and details how to fix the underlying problem that caused it to appear.

Explanation

This message appeared when a client tried to restore a SQL backup file made from another instance of SQL using a newer version.

Solution

SQL is generally not backwards compatible.  The original back up file must be recreated in the same version of SQL that will restore it.

Error First Appeared: Windows 7 running Microsoft SQL Management Studio 2008R2

Dave Klement

Principal at Efficient Business Systems

In this post, we’re gonna solve the specified cast is not valid. (sqlmanagerui) error that occurs when you trying to restore a database from SQL Server 2012 to an earlier version.

  1. 1
    The specified cast is not valid. (sqlmanagerui)

    1. 1.1
      Cause

    2. 1.2
      Restore a Database Backup to an earlier version in SQL Server

You might also like to read Database was backed up on a server running version 13


In SQL Server 2008 R2, I tried to restore a database backup that has been taken from SQL Server 2012, by doing the following:

DBrestore
RestoreDB

Unfortunately, after clicking OK. I got the following error

The specified cast is not valid. (sqlmanagerui)

The specified cast is not valid. (sqlmanagerui)

Cause

The database restore operation is only allowed as a move forward which means, you can restore the database from 2005 or 2008 to the 2012 version but it’s not applicable in reverse order.

Restore a Database Backup to an earlier version in SQL Server

The simple solution to achieve that is to use “Script and Data Generator Wizard” to create  T-SQL script, then run it at the destination SQL Server with earlier version.

3

For more details, about the wizard setting, please check Missing data in SQL Generate Scripts


Conclusion

In conclusion, we have learned how to restore a Database Backup to an earlier version in SQL Server.

Applies To
  • SQL Server 2012.
  • SQL Server 2008.
See Also
  • Extend SQL Server Evaluation Period: SQL Server Evaluation Period has expired.
  • Restore Transaction Log grayed out in SQL Server 2017.

Follow us on Social Media

Specified Cast Is Not Valid. (Sqlmanagerui) With Code Examples

Hello everyone, in this post we will look at how to solve Specified Cast Is Not Valid. (Sqlmanagerui) in programming.

The GUI can be fickle at times. The error you got when using T-SQL is because you're trying to overwrite an existing database, but did not specify to overwrite/replace the existing database. The following might work:

Use Master
Go
RESTORE DATABASE Publications
  FROM DISK = 'C:\Publications_backup_2012_10_15_010004_5648316.bak'
  WITH 
    MOVE 'Publications' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.mdf',--adjust path
    MOVE 'Publications_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2008R2\MSSQL\DATA\Publications.ldf'
, REPLACE -- Add REPLACE to specify the existing database which should be overwritten.

By examining various real-world cases, we’ve shown how to fix the Specified Cast Is Not Valid. (Sqlmanagerui) bug.

Which is not valid SQL database?

DECIMAL is not a valid SQL type because it is nothing but numeric only in SQL.

How do I fix no Backupset selected to be restored?

Steps to Fix SQL Server No Backupset Selected to Be Restored Error

  • Download and Launch the SQL BAK File Recovery Tool.
  • Click Open, and then click Browse to load the SQL Server .bak file.
  • Select SQL .bak file version, if you don’t know the exact version, simply click on Auto Detect option.

How do I determine SQL Server version?

Finding the SQL Server version with query We can use the @@VERSION function to find out all version details of the SQL Server instance. The @@VERSION function returns a one-line string output and this output also provides all the necessary information about the SQL Server.08-Oct-2019

Which is the valid data type in SQL?

Because Characters, Numeric, and Float are all valid SQL types. If you are willing to learn SQL and wish to get certified in SQL, have a look at the SQL certification course from Intellipaat.23-Mar-2021

Which of the following is not a valid date and time data type in SQL?

Which of the following is not a valid Date and Time data type? Explanation: datestamp is not a valid Date and Time data type. Timestamp exists but datestamp does not exist in SQL.

How do I restore my database?

A. Restore a full database backup

  • In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.
  • Right-click Databases and select Restore Database
  • On the General page, use the Source section to specify the source and location of the backup sets to restore.

How do I restore a local SQL Server database?

Procedure

  • Log in to the computer on which you want to restore the database.
  • Open Microsoft SQL Server Management Studio.
  • In the left navigation bar, right-click on Databases and then click Restore Database.
  • In the Source section, select Device and click the button with three dots.

Returns a result set containing all the backup header information for all backup sets on a particular backup device in SQL Server. Note.02-Sept-2022

How do I connect to a local SQL Server?

Connect to the SQL Server using SSMS Next, from the Connect menu under the Object Explorer, choose the Database Engine… Then, enter the information for the Server name (localhost), Authentication (SQL Server Authentication), and password for the sa user and click the Connect button to connect to the SQL Server.

How do you check if SQL is installed on a server?

Click Start, point to All Programs, point to Microsoft SQL Server, point to Configuration Tools, and then click SQL Server Configuration Manager. If you do not have these entries on the Start menu, SQL Server is not correctly installed.14-Sept-2022

Follow us on Social Media

Понравилась статья? Поделить с друзьями:
  • Ошибка rfc ивеко стралис что означает
  • Ошибка spdt sys
  • Ошибка spas киа соренто
  • Ошибка rfc sap
  • Ошибка sparse file not allowed