COLLATION Between two databases, checking on which collate to use

  • DATABASE A SQL_Latin1_General_CP850_BIN

    DATABASE BSQL_Latin1_General_CP1_CI_AS

    TEMPDBSQL_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

    )

  • 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

    )

    _____________
    Code for TallyGenerator

  • Would the temp table not be collate at 850 so i dont have to change my update code aswell.

  • All other tables are the defaults, not set to 850

  • 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.

    _____________
    Code for TallyGenerator

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply