I have SQL Server 2014 Express edition installed on a Portuguese Windows 10 computer. I have a database that was created on an US computer. I have changed the collation of the database in SSMS. I examine tables, stored procedures, etc and they all have the default collation of SQL Server (Latin1_General_CI_CA).
When I try to execute a stored procedure in the database, SQL Server barfs up a collation mismatch between Latin1_General_CI_AS and SQL_Latin1_CP1_CI_AS. I have checked everything that I know of and the collation matches.
Really hoping to avoid rewriting all my stored procedures to set the default collation.
Anyone have any ideas?
Thanks in advance.
Related
I'm looking for a way to create a command line script to backup SQL Server 2016 which can be restored in a older version SQL Server 2012.
We have a daily backup from our SQL Server 2016 using the
BACKUP DATABASE XXXX TO DISK = "C:\BACKUP.BAK"
and this back up is provided to a 3rd party which is running an older SQL Server 2012.
When they use SMSS they get an error stating an error about the incompatible version.
I've tried using ALTER DATBASE XXXX SET COMPATIBILITY_LEVEL = 110 ( targeting even a lower than SQL Server 2012 version)... thinking it can be loaded in their 2012 but when they try to load it, it still states that the backup file is in 2016 (v13.xxx) ?!
Sample backup script
USE MYDB;
ALTER DATABASE MYDB SET SINGLE_USER
GO
-- TARGETING SQL Server SQL Server 2012
ALTER DATABASE MYDB SET COMPATIBILITY_LEVEL = 110
GO
BACKUP DATABASE MYDB
TO DISK = 'C:\TEMP\MYDB.BAK'
ALTER DATABASE MYDB SET MULTI_USER
GO
Can anyone let me know what Im doing wrong?
Thanks
You just simply CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility. And the "database compatibility level" also doesn't help.
You can either get around this problem by
using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances
otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool
or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.
I state that I'm new to SQL Server.
With my company we are planning to migrate from SQL Server 2008 to SQL Server 2012 and I have this question.
The application which uses SQL Server 2008 was born as a one language application (Italian in this case) but later has been converted to a multi language application that requires UTF-8 encoded data.
So the DB server has been filled with custom "collation" clause on column, query and procedures to avoid data encoding errors.
Now we have configured a SQL Server 2012 instance with all the right collation since the start and I was wondering in how to migrate data between servers.
How can I tell the dbms to dump the data into UFT-8 and omit all those "collation" clauses?
Sorry for my bad English.
I recently did a Oracle to SQL Server 2008 R2 Migration. The PL/SQL stored procedures were converted to T/SQL by SSMA. The converted T/SQL has many references to the sysdb database, for instance sysdb.ssma_oracle.db_check_init_package
I then exported the SQL Server 2008 R2 database, and imported it to SQL Server 2012. However I forgot to copy the sysdb database. What is the easiest way of creating the sysdb database?
Thank you!
Just install SSMA for Oracle 5.2 Extension Pack.exe (downloadable from Microsoft) on the computer with the SQL Server database (tell it to ignore the fact that Oracle is not installed on the computer) and it will create the sysdb database for you, and also the Extended Stored Procedures that it needs.
I've been working on SQL server 2005 for a few years and i'd never come across collation issues. However i installed SQL 2008 on a virtual machine and tried to sync my 2005 database with the new 2008 server using Redgate SQL compare. It failed complaing about the collation on the 2 servers being different.
After a quick bit of research i discovered my 2005 is using Latin1_General_CI_AS and the new 2008 installation is using SQL_Latin1_General_CP1_CI_AS.
Why is 2008 using something different to 2005? Both times i've just done a default install. Secondly what should i do to get them the same, which collation is the correct one?
I do not know what criteria is used for the MS SQL Server installer to select default collation.
Collation of a server does not have to be the same as the collation of a database on that server. Collation of a database does not have to be the same as the collation of table columns in the database.
You can set the collation of the database when you create one. Default it will get the same collation as the server.
Here is a post about how you can change the collation of a database including changing the collation of columns.
Changing SQL Server Database sorting
with a reference to here http://support.microsoft.com/kb/325335.
Here is a starting point if you need to change the default collation of a server
http://msdn.microsoft.com/en-us/library/ms179254.aspx.
I do not know what is necessary for Redgate SQL Compare, but I guess it only needs the database collation to be the same. So if you are replicating a db to a new server you probably only need to create the new db with the same collation as the one you already have and leave the default collation of the server as is.
how can we get the restore in sql server 2000 of sql server 2005 data
You can't restore data from sql 2005 to 2000 only if you generate scripts with sql server 2000 compatibility. If you want create and restore backup can't do.
I recently found myself in a similar position on a client site. I came across an article on the MSDN SQL Server Forum (second response from top) with a detailed walk-through on this issue.
I ran into a few issues with scripting users & had to hack my way through it a little bit, but it was a great starting point for me.
I do not think this is possible. You can't go from 2005 to 2000, what you would have to do is install SQL 2005 Express then restore to that and you should be able to manage the backup from there.
If you only need the database structure you can generate scripts for the entire database.
Try this:
In the Properties window of the SQL 2005 Database you can set the compatibility level of that database to SQL 2000. Then perform the backup and then restore to SQL 2000.
If you don't want change the compatibilty level of your original database, just do a backup first and restore the database as a dummy in SQL 2005 and set that database's compatibility level.
alt text http://img411.imageshack.us/img411/8541/clipboard01lro.jpg
Use RedGate SQL Compare and RedGate SQL Data Compare to push the tables and data from SQL 2005 to SQL 2000.
You may be able to script the whole database from SQL 2000 compatibility mode, but getting the data requires something besides a backup and a restore. You could try bulk saving and bulk loading data, too...