Quantcast
Channel: SQLServerCentral » SQL Server 2012 » SQL Server 2012 - T-SQL » Latest topics
Viewing all articles
Browse latest Browse all 4901

CONTAINED DATABASE OR NOT ...

$
0
0
In a POC project I was looking into the SQL Server 2012 feature of partially contained databases.To my surprise I encountered an error where I didn't expect one.The code hereafter is a simplified test-case.Server Collation = Latin1_General_CI_ASCollation on database test is the same.Running the code when database test has CONTAINMENT = PARTIAL gives an error (see below)Running the code when database test has CONTAINMENT = NONE doesn't give any error.So it seems that there is some change in collation behavior depending on the CONTAINMENT type ...[code="plain"]USE [master]GOALTER DATABASE [test] SET CONTAINMENT = PARTIAL WITH NO_WAIT -- WILL RESULT IN ERROR-- ALTER DATABASE [test] SET CONTAINMENT = NONE WITH NO_WAIT -- WILL WORKGOUSE [test]GODROP TABLE TEST_CASEGOCREATE TABLE TEST_CASE ( name varchar(10) NOT NULL , CONSTRAINT PK_LOG_FILTER_PK PRIMARY KEY CLUSTERED (name) )GO;MERGE INTO TEST_CASE TargetUSING ( SELECT 'case' AS name ) SourceON ( Target.name = Source.name )WHEN NOT MATCHED BY TARGET THEN INSERT ( name ) VALUES ( Source.name )WHEN NOt MATCHED BY SOURCE THEN DELETEOUTPUT $action , CASE WHEN $action = 'INSERT' THEN 'ADDED' WHEN $action = 'DELETE' THEN 'REMOVED' END ACTION , inserted.name , deleted.name;[/code][quote]Msg 468, Level 16, State 9, Line 12Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "Latin1_General_100_CI_AS_KS_WS_SC" in the equal to operation.[/quote]Can anyone give me a satisfactory explanation ...

Viewing all articles
Browse latest Browse all 4901

Trending Articles