Temp Table collation conflict - Error : Cannot resolve the collation conflict between Latin1* and SQL_Latin1*

后端 未结 4 2068
一整个雨季
一整个雨季 2021-02-02 09:20

I can\'t update temp table. This is my query

CREATE TABLE #temp_po(IndentID INT, OIndentDetailID INT, OD1 VARCHAR(50), OD2 VARCHAR(50), 
        OD3 VARCHAR(50),         


        
4条回答
  •  醉梦人生
    2021-02-02 09:34

    Changing the server collation is not a straight forward decision, there may be other databases on the server which may get impacted. Even changing the database collation is not always advisable for an existing populated database. I think using COLLATE DATABASE_DEFAULT when creating temp table is the safest and easiest option as it does not hard code any collation in your sql. For example:

    CREATE TABLE #temp_table1
    (
        column_1    VARCHAR(2)  COLLATE database_default
    )
    

提交回复
热议问题