我有存储过程
if OBJECT_ID(N'dbo.spGetProducts') is not null
drop procedure dbo.spGetProducts
go
CREATE procedure [dbo].[spGetProducts]
(
@sort_col varchar(100), @sort_dir varchar(4),
@start int, @num int, @filters nvarchar(2000)) as
begin
declare @end int
declare
@res table
(
row_num int,
product_name nvarchar(max)
)
set @end = @start+@num
insert into @res
EXEC
(
'select * from
(
select (ROW_NUMBER() OVER (ORDER BY '+@sort_col+' '+@sort_dir+')) row_num,
* FROM (select product_name from Products where '+@filters+') as x
) as tmp where row_num between '+@start+' and '+@end
) select row_num, product_name from @res
end
go
当我完美地执行存储过程时latin characters
,但是当我使用cyrillic
字符时does not return anything
..
这是执行行:
拉丁字符 - 工作:
exec dbo.spGetProducts 'product_name','desc',0,50,' product_name like N''%abs%'''
西里尔字符 - 不工作:
exec dbo.spGetProducts 'product_name','desc',0,50,' product_name like N''%абв%'''
我也手动设置要使用的存储过程
'product_name like N''%абв%'''
入行
select product_name from Products where '+@filters+'
IE
select product_name from Products where product_name like N''%абв%'''
这个 WORKS ,所以我不知道如何解决这个问题..