1

代码:

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 中运行上述查询时,我得到以下结果:

截屏

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

4

2 回答 2

1

通过以下方式管理排序规则:SELECT SERVERPROPERTY('Collat​​ion')

于 2013-09-26T02:28:56.887 回答
0

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

SELECT SERVERPROPERTY('Collation')
于 2013-09-26T00:04:44.020 回答