自定义查询转换nchar sql类型中的dt_wstr

时间:2015-05-15 10:31:26

标签: sql-server ssis ssis-2012

我在查找ssis中创建了这个自定义查询:

SELECT TOP 1 * 
from (select * from [dbo].[TyrePoints]) [refTable]
where ([refTable].[brand] LIKE ? OR [refTable].[brand] = '*')

ORDER BY [refTable].[priority] DESC

“?”由dt_wstr(20)变量和[refTable]替换。[brand]是db中的nvarchar(20)字段。

当我使用sql profiler检查此查询的结果时,我得到:

exec sp_executesql N'SELECT TOP 1 * 
from (select * from [dbo].[TyrePoints]) [refTable]
where ([refTable].[brand] LIKE @P1 OR [refTable].[brand] = ''*'')
ORDER BY [refTable].[priority] DESC',N'@P1 nchar(20)',N'test                '

为什么SSIS会在nchar中转换我的dt_wstr类型?

如何获得nvarchar类型的结果?

0 个答案:

没有答案