SQL排序规则不匹配问题

时间:2014-01-08 21:50:40

标签: sql sql-server sql-server-2008 vbscript powerdesigner

从ADODB.RecordSet获取数据时遇到一些排序规则(?)问题。 当使用SQL Management studio进行选择时,一切看起来都很好

PriceMonitoring Справочник конкурентов2_Temp    Table   6142061 dbo

Buuut,当我从powerdesigner的vbscript获取数据时,我得到的表名不匹配

Table
    Not in Model    dbo.Ni?aai?iee eiieo?aioia2_Temp
    Not in DB       dbo.Справочник конкурентов2_Temp

目前我已经尝试在我的sql脚本中指定不同的排序规则(COLLATE SQL_Latin1_General_CP1_CI_AS,Cyrillic_General_CI_AS,Ukrainian_CI_AS)。我甚至改变了DB校对,这没有帮助,对结果没有影响。任何想法,社区?

这是sql脚本的一部分。

SET NOCOUNT ON
USE DB_Control
SELECT ds.*, isnull(upo.Object_Name,'') as Object_Name_Updated, isnull(tuo.Object_Name,'') as Object_Name_Uncontrol 
FROM 
    -- 
    dbo.Design_Checksum AS ds 
    -- 
    LEFT JOIN dbo.Uncontrolled_Object AS uo 
    ON  uo.DB_Name          = ds.DB_Name 
    AND uo.Object_Type_ID   = ds.Object_Type_ID 
    AND uo.Schema_Name      = ds.Schema_Name 
    AND uo.Object_Name COLLATE SQL_Latin1_General_CP1_CI_AS     = ds.Object_Name COLLATE SQL_Latin1_General_CP1_CI_AS
    -- 
    LEFT JOIN dbo.Updated_Object AS upo 
    ON  upo.DB_Name         = ds.DB_Name 
    AND upo.Object_Type_ID  = ds.Object_Type_ID 
    AND upo.Schema_Name     = ds.Schema_Name 
    AND upo.Object_Name COLLATE SQL_Latin1_General_CP1_CI_AS    = ds.Object_Name COLLATE SQL_Latin1_General_CP1_CI_AS
    -- 
    LEFT JOIN PD.Test_Uncontrolled_Object AS tuo 
    ON  tuo.DB_Name         = ds.DB_Name 
    AND tuo.Object_Type_ID  = ds.Object_Type_ID 
    AND tuo.Schema_Name     = ds.Schema_Name 
    AND tuo.Object_Name COLLATE SQL_Latin1_General_CP1_CI_AS    = ds.Object_Name COLLATE SQL_Latin1_General_CP1_CI_AS
    AND (tuo.Date_End IS NULL 
       OR tuo.Date_End > GETDATE()) 
WHERE  
    ds.DB_Name = 'PriceMonitoring'  
    AND uo.Object_Name IS NULL 
ORDER BY  
    UPPER(REPLACE(ds.Object_Type_ID, '_', '!')),  
    UPPER(REPLACE(ds.Schema_Name, '_', '!')),  
    UPPER(REPLACE(ds.Object_Name, '_', '!')) 

0 个答案:

没有答案