請參閱下面的查詢:我在哪裏放置整理條款?
SELECT IDNUMBER collate SQL_Latin1_General_CP1_CI_AS AS ciscrimeurn,
WID AS nicheoccurrenceid,
OccurrenceFileNo AS nicheoccurrencefilno
FROM [rmslive\sql2005].NicheRMS_Live.dbo.TBL_GOCCID
INNER JOIN [rmslive\sql2005].NicheRMS_Live.dbo.tbl_goccurrence
ON tbl_goccid.wid = tbl_goccurrence.id
WHERE tbl_goccid.ID LIKE '2060609955%'
UNION
SELECT NULL AS ciscrimeurn,
id AS nicheoccurrenceid,
occurrencefileno AS nicheoccurrencefilno
FROM [rmslive\sql2005].NicheRMS_Live.dbo.tbl_goccurrence
WHERE id NOT LIKE '90309955%'
EXCEPT
SELECT CISIDNumber collate SQL_Latin1_General_CP1_CI_AS,
OccurrenceID,
OccurrenceFileNo
FROM dbNicheCIS
NicheRMS_Live和dbNicheCIS有不同的排序規則。兩者都是SQL服務器數據庫。
順時針是一個varchar,nicheoccurrenceid是一個小數,OccurrenceFileNo是一個整數。我不明白把整理條款放在哪裏。
檢查了這一點 http://stackoverflow.com/questions/4405316/sql-server-2008-database-collation-conversion – 2014-10-10 11:49:06
整理控制的順序排序字符串和字符。因此,在適用的列類型上使用它,在這種情況下,您的順時針字段。 – Kahn 2014-10-10 11:57:40