SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


COLLATION Between two databases, checking on which collate to use


COLLATION Between two databases, checking on which collate to use

Author
Message
TRACEY-320982
TRACEY-320982
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 1014
DATABASE A SQL_Latin1_General_CP850_BIN
DATABASE B SQL_Latin1_General_CP1_CI_AS
TEMPDB SQL_Latin1_General_CP1_CI_AS

UPDATE DATABASEA.TABLE1
SET XXDT = A.COMPLT_DT -1
FROM DATABASEB.TABLE2 A
INNER JOIN DATABASEA.TABLE1 B ON A.ID = B.ID COLLATE Latin1_General_CI_AS
WHERE A.ID = B.ID COLLATE Latin1_General_CI_AS AND ISDATE(A.SYS_DT) = '1'
AND A.DATECOM= @DateCom

If i am writing back to a database table that is set to 850, does the check need to be COLLATE Latin1_General_CP850_BIN ?

How do we create temp tables with collation 850?

CREATE TABLE ##TS_ACCT (
[TS_ID] [nvarchar](100) NULL

)
Sergiy
Sergiy
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13920 Visits: 12139
You may use COLLATE DATABASE_DEFAULT for columns coming from other databases.
Unless some tables in the database have not DB default collation.

Same for temp tables:


CREATE TABLE ##TS_ACCT (
[TS_ID] [nvarchar](100) COLLATE DATABASE_DEFAULT NULL
)


TRACEY-320982
TRACEY-320982
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 1014
Would the temp table not be collate at 850 so i dont have to change my update code aswell.
TRACEY-320982
TRACEY-320982
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1724 Visits: 1014
All other tables are the defaults, not set to 850
Sergiy
Sergiy
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13920 Visits: 12139
TRACEY-320982 (5/3/2013)
Would the temp table not be collate at 850 so i dont have to change my update code aswell.


If 850 is the default collation for the datanase then the columns in #Temp using DATABASE_DEFAULT collation will be obviously in 850.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search