字符集--相关技巧

--================================================
--查看数据库和表中列字段的字符集
USE DB1
GO
SELECT DB.collation_name FROM sys.databases DB
WHERE DB.database_id=DB_ID()
GO
SELECT
T.name AS TableName,
C.name AS ColumnName,
C.collation_name AS ColumnCollationName
FROM sys.tables T
INNER JOIN sys.columns C
ON T.object_id=C.object_id
GO
--================================================
--在查询中指定排序规则
 SELECT *
 FROM TB1
 INNER JOIN TB2
 ON TB1.C1=TB2.C1
 COLLATE greek_ci_as;

posted on 2014-01-16 16:12  笑东风  阅读(322)  评论(0编辑  收藏  举报

导航