Which TransactSQL statement should you use?

Your server collation is SQL_Latin1_General_CP1_CI_AS. You have a database named Contoso that
has a collation setting of SQL_Scandinavian_Cp850_CI_AS. You create and populate a temporary
table
#Person from table dbo.Person in Contoso using the following statements:
use MyDB;
CREATE TABLE #Person (LastName nchar(128));

INSERT INTO #Person SELECT LastName FROM dbo.Person;
You then run the following command:
SELECT * FROM dbo.Person a JOIN #Person b
ON
a.LastName = b.LastName;
This command returns the following error:
Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and
“SQL_Scandinavian_Cp850_CI_AS” in the equal to operation. You need to resolve the collation
conflict.
Which TransactSQL
statement should you use?

Your server collation is SQL_Latin1_General_CP1_CI_AS. You have a database named Contoso that
has a collation setting of SQL_Scandinavian_Cp850_CI_AS. You create and populate a temporary
table
#Person from table dbo.Person in Contoso using the following statements:
use MyDB;
CREATE TABLE #Person (LastName nchar(128));

INSERT INTO #Person SELECT LastName FROM dbo.Person;
You then run the following command:
SELECT * FROM dbo.Person a JOIN #Person b
ON
a.LastName = b.LastName;
This command returns the following error:
Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and
“SQL_Scandinavian_Cp850_CI_AS” in the equal to operation. You need to resolve the collation
conflict.
Which TransactSQL
statement should you use?

A.
CREATE TABLE #Person (LastName nvarchar(128) SPARSE);

B.
CREATE TABLE #Person (LastName nvarchar(128) COLLATE database_default);

C.
CREATE TABLE #Person (LastName nvarchar(128) COLLATE SQL_Latin1_General_CP1_CI_AS);

D.
CREATE TABLE tmpPerson (LastName nvarchar(128) COLLATE SQL_Latin1_General_CP1_CI_AS);



Leave a Reply 0

Your email address will not be published. Required fields are marked *