I thought that SQL Azure was built on top of SQL Server 2012, but the compatibility level when you create a new database is 100 (SQL Server 2008's compatibility level), not 110.
SELECT compatibility_level FROM sys.databases WHERE name = 'Test';
I tried changing it to 110 using the two methods that I am aware of:
ALTER DATABASE Test SET COMPATIBILITY_LEVEL = 110;
--> Incorrect syntax near 'SET'.
EXEC sp_dbcmptlevel 'Test', 110;
--> Could not find stored procedure 'sp_dbcmptlevel'.
The reason this is an issue for me is because SQL 2008 doesn't support geography shapes which cross hemispheres, so if you zoom out a map to see the world and try to store the bounds of the map it will fail. Pretty silly right?
I thought that this would not be an issue in SQL Azure, because it has been fixed in SQL Server 2012, but when I try to create a shape that crosses hemispheres I get the following error:
Microsoft.SqlServer.Types.GLArgumentException: 24205: The specified input does not represent a valid geography instance because it exceeds a single hemisphere. Each geography instance must fit inside a single hemisphere. A common reason for this error is that a polygon has the wrong ring orientation. To create a larger than hemisphere geography instance, upgrade the version of SQL Server and change the database compatibility level to at least 110.
So it is telling me to change the compatibility level, like it knows that this has been fixed already, but I can't figure out how to do that in SQL Azure. Anyone have a suggestion of something to try? Or let me know if it just is not possible right now?
It is hard to say if the current SQL Azure is based on SQL Server 2008 or 2012 however November 2011 update adds lots of new feature to it from SQL Server 2008 and 2012. More Info on Database Engine Versions:
Updated Engine Version: This release updates the underlying SQL Azure database engine version from 11.0.1477.26 to 11.0.1750.34 as it is rolled out across data centers.
The following link talks about what is and what not supported with SQL Azure comparative to SQL Server 2008 and SQL Server 2008 R2:
http://msdn.microsoft.com/en-us/library/windowsazure/ff394115
The following links adds more info about what new Programmability Enhancements are added in SQL Azure from SQL Server 2012:
http://msdn.microsoft.com/en-us/library/windowsazure/hh987034.aspx
UPDATE: August 2015
Azure Sql Database V12 has a default compatibility level of 120 with possibility to go up to 130 or down using ALTER DATABASE SET COMPATIBILITY_LEVEL syntax.
Related
How open my SQLServer2008R2 database in SQLServer2012. When I open the database these problems happened:
I can't edit and open tables because this error show:
Invalid prefix and suffix characters.
When I want design tables this error show:
The backend version isn't supported to design database diagram or tables.
When you detach and attach database, the compatibility level of old database is maintained. It is one of the limitations of detach and attach method.
Reference
If we attach a database having a higher version, SQL Server maintains
the database compatibility. We can change the compatibility level once
the database is online
Once you change the compatibility level to suit SQL Server 2012, you can use the new features of the SQL Server 2012.
Read more on upgrading database
ALTER DATABASE DatabaseName SET COMPATIBILITY_LEVEL = 110
GO
I have uploaded my product to Azure and SQL Server, but I found really interesting issue working with Azure. Azure by default provides RTM version of SQL Server, which is creating this issue.
The RTM version image for calculation - the screenshot shows how calculation outputs the value.
The second screenshot is my local SQL Server 2014 - so why does the RTM version have this issue? Is there any settings or solution for this to return proper value like in SQL Server 2014?
Decimal 0.00750 is value 7.4999999999999997E-3 when cast to float (although SSMS will show 0.0075). Using SQLCMD, you can see the actual value:
sqlcmd -Q"DECLARE #c float = 0.00750;SELECT #c as float,ROUND(#c, 3) AS rounded;"
Results:
float rounded
------------------------ ------------------------
7.4999999999999997E-3 7.0000000000000001E-3
If you change the database compatibility level to 120 (SQL 2016) of the database (on-prem, Azure SQL Database Managed Instance, or Azure SQL Database):
ALTER DATABASE YourDatabase SET COMPATIBILITY_LEVEL = 120;
and repeat the same query, then the result is incorrectly rounded like your SQL 2016 instance:
float rounded
------------------------ ------------------------
7.4999999999999997E-3 8.0000000000000002E-3
Remember that float is approximate and cannot exactly represent all decimal values. So Azure SQL Database is the correct rounding behavior but the behavior can be controlled with the database compatibility level to provide backwards compatibility, if needed.
I have two SQL Server 2008 instances, one running Workgroup Edition (publisher) and the other Standard (subscriber)
I am trying to replicate a database but I am getting errors when it tries to create the database at the subscriber because it thinks it is running SQL Server 2005 for some reason.
Has anyone had this issue before?
I am getting this error
Column Location in object Members contains type Geography, which
is not supported in the target server version, SQL Server 2005.
Have you checked compatibility mode for the databases?
For example:
SELECT compatibility_level
FROM sys.databases WHERE name = 'YourDBName';
I used the below command to create a database snapshot in SQL Server 2008 R2:
CREATE DATABASE "dbss" ON (
NAME = "os-file-name",
FILENAME = 'path')
AS SNAPSHOT OF "dbName";
GO
I got this error:
Database Snapshot is not supported on Standard Edition (64-bit).
Does anyone knows how can I create a database snapshot in SQL Server 2008 R2?
Database Snapshot is a feature of the Enterprise Edition and the 2008 Developer Edition.
Besides that there is only little use of Snapshots for a "common user". Most things can be done with a backup too.
Main purpose for snapshots are expensive queries on rapidly changing data.
If you got a huge database and need to execute a query for a report that takes some time there is the danger that data may change while the query / procedure fetches data for the report. In this case you need snapshots. There you can query all your data without having problems with changing data.
Is there a way (a tool) to check that a SQL Server 2008 script will run on SQL Server 2005?
Open up SQL Management studio, rt mouse click on the database name, select properties, select option, set compatability level. Test. A far as is known, when the compatabailty level is set to a (lower) level, functionality is disabled and errors raised entirely in line with the selected level. MS are a bit relctant to comit http://msdn.microsoft.com/en-gb/library/bb510680.aspx but in practice I've not found any issues. You can of course install an instance of the 2005 build and bulk insert for a really thorough check.
You can use SQL Fiddle for SQL Server 2008
At the left top you can select the RDMS