Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SQL查询_Sql_Sql Server - Fatal编程技术网

使用SQL查询

使用SQL查询,sql,sql-server,Sql,Sql Server,如何在where条件下使用日语关键字。例如: select * from tbl_Mst_Product_Language where Name = N'闲云舒展' 在上面的查询中,在where条件下,我使用了日语关键字,效果很好。但是我想把这个值放在变量中,因为我需要从c#传递这个值 我所面临的问题是,我试图把条件放在变量中的什么地方。比如说 declare @test as nvarchar(max) set @test = '闲云舒展' select * from tbl_M

如何在where条件下使用日语关键字。例如:

select * from tbl_Mst_Product_Language  where Name = N'闲云舒展'    
在上面的查询中,在where条件下,我使用了日语关键字,效果很好。但是我想把这个值放在变量中,因为我需要从c#传递这个值

我所面临的问题是,我试图把条件放在变量中的什么地方。比如说

declare @test as nvarchar(max)
set  @test = '闲云舒展'
select * from tbl_Mst_Product_Language  where Name =  @test
如果您有:

declare @test as nvarchar(max)
set @test = '闲云舒展'
select * from tbl_Mst_Product_Language where Name = @test
尝试:


那么问题出在哪里呢?就这么做吧。请解释一下你被困在哪里,因为就目前的情况而言,这不是一个问题。
set@test=闲云舒展'可能更好,因为
set@test=N'闲云舒展'
declare @test as nvarchar(max)
set @test = N'闲云舒展' -- Note here, N
select * from tbl_Mst_Product_Language where Name = @test