我在哪里放置整理条款?

时间:2014-10-10 11:41:16

标签: sql sql-server

请参阅以下查询:

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服务器数据库。

ciscrimeurn是一个varchar,nicheoccurrenceid是一个小数,而OccurrenceFileNo是一个整数。我不明白在哪里放置整理条款。

1 个答案:

答案 0 :(得分:0)

如果您想要更改列整理,那么

SELECT columnName COLLATE COLLATION_NAME
FROM   tableName