编码错误

时间:2013-09-25 23:53:38

标签: sql sql-server sql-server-2008

代码:

SELECT
       ta_name,
       countt,
       ta_unit,
       ta_id_producer_goods
FROM (
    SELECT  ta.name AS ta_name,
        ta.unit  AS ta_unit,
        ta.id_producer_goods AS ta_id_producer_goods,
        count(*) over(partition by ta.name) as countt,
        ROW_NUMBER() over(partition by ta.name order by getdate()) as r
    FROM  Table ta
    WHERE  id_city = '24'
       AND id_firm = '22131'
       AND id_service = '5'
) x
WHERE r=1

当我在SQL Server Management Studio中运行上述查询时,我得到了以下结果:

screenshot

为什么我会得到编码错误的结果以及如何获得正确的编码?

2 个答案:

答案 0 :(得分:1)

通过以下方式管理您的整理: SELECT SERVERPROPERTY('整理')

答案 1 :(得分:0)

您可以通过以下方式获取默认合并:

SELECT SERVERPROPERTY('Collation')