我正在尝试连接一个字符串,以便我可以在in语句中使用它。我收到了一个错误:
“'='附近的语法不正确。”
我正在做什么?
DECLARE @Year uniqueidentifier = (SELECT TOP 1 y.des_zyearId FROM des_zyearset y WHERE y.des_YearText = 2015)
--this is where I'm trying to concatenate
declare @heat varchar(70) = ('''' + (select top 1 fu.des_zfuelusagetypeId from des_zfuelusagetypeSet fu where = 'heat') + ', ' + (select top 1 fu.des_zfuelusagetypeId from des_zfuelusagetypeSet fu where = 'both') + '''')
答案 0 :(得分:0)
declare @heat varchar(70) =
('''' + (select top 1 fu.des_zfuelusagetypeId from des_zfuelusagetypeSet fu
where = 'heat' --->error here
)
+ ', ' + (select top 1 fu.des_zfuelusagetypeId from
des_zfuelusagetypeSet fu
where = 'both' --->error here
) + '''')
select
语句中存在错误。您说的是where = 'heat'
,它应该是where fu.somecolumn = 'heat'
。同样,将其更改为第二个select