declare @userNum varchar(50),@waterNum varchar(50),@tableName varchar(20),@sql varchar(max)
select @userNum=YHBH,@waterNum=SBBH,@tableName=vlg.vlgFZ from YHXX yh left join vlgInf vlg on yh.vlgName=vlg.vlgName where (yh.vlgName+yh.YHDZ) like '恒大金碧天下13幢1单元0101室%'
set @sql='select JZQID,SBBH from '+@tableName+' where YHBH='''+@userNum+''' and SBBH='''+@waterNum+''''
exec(@sql)

 

where YHBH=' ''+@userNum+' '' and SBBH='''+@waterNum+''''

边界 ' 单引号 用' 单引号 转义

相关文章:

  • 2021-12-31
  • 2021-12-31
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
猜你喜欢
  • 2021-08-20
  • 2021-11-16
  • 2022-02-06
  • 2021-12-27
  • 2022-12-23
  • 2021-07-28
  • 2021-07-31
相关资源
相似解决方案