我有以下代码
let whereClause = 'CurLocation =' + GS
+ ' and Datediff(DD,LastKYCVerified,GetDate()) >= 180 and CreditCard = ' + 'ACTIVE ' +
' and ClientId Not In (Select ClientId from KYCChangeInfo(Nolock))';
在数据库中执行时,GS应该使用单引号,因为CurLocation是字符串变量。如何将单引号添加到GS和ACTIVE
答案 0 :(得分:1)
尝试一下:
let whereClause = 'CurLocation =\'' + GS
+ '\' and Datediff(DD,LastKYCVerified,GetDate()) >= 180 and CreditCard = \'' + 'ACTIVE ' +
'\' and ClientId Not In (Select ClientId from KYCChangeInfo(Nolock))';