SQL2008排序规则错误
我在管理器里面看了,数据库默认排序是Chinese_Taiwan_Stroke_CI_AS,所有表的默认排序也是Chinese_Taiwan_Stroke_CI_AS
表结构(在过程里面自动创建):
exec ('CREATE TABLE [dbo].['+@tb_name+'] (
[SerialNo] [numeric](18, 0) IDENTITY (1, 1) not NULL ,
[ModelName] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[BarcodeNo] [varchar] (30) COLLATE Chinese_PRC_CI_AS not NULL ,
[Station] [varchar] (5) COLLATE Chinese_PRC_CI_AS not NULL ,
[Information] [varchar] (4096) COLLATE Chinese_PRC_CI_AS not NULL ,
[Upload_Date] [datetime] default getdate() not NULL
) ON [PRIMARY]')
select * from Y2013_2 where 1=1 and BarcodeNo='CC16711214' and Station='1528' and Upload_Date >='2010-01-12' and Upload_Date <='2013-07-03' union select * from Y2013_1 where 1=1 and BarcodeNo='CC16711214' and Station='1528' and Upload_Date >='2010-01-12' and Upload_Date <='2013-07-03' order by upload_date desc
select * from Y2013_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2013_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2012_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2012_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2011_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2011_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2010_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2010_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2009_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2009_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2008_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2008_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2007_2 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS union select * from Y2007_1 where 1=1 and BarcodeNo='1234' COLLATE Chinese_PRC_CI_AS
USE master;
GO
ALTER DATABASE DBName
COLLATE Chinese_PRC_CI_AS;
GO