在 sql 中插入单引号
insert Single Quotation Marks in sql
我想在现有 table 的 AlertSQL 列中插入“exec e_Report.dbo.FTX_FA_Aging_Report_sp 'FACloedAgingReport'”。
我的更新脚本会怎样?
我的更新脚本如下:
update dbo.F_ALERT
set AlertSQL= 'exec e_Report.dbo.FTX_FA_Aging_Report_sp '''FACloedAgingReport''
where AlertID=9330
为什么它没有给我预期的结果。
提前致谢!!
你需要更多的引语和东西:
update dbo.F_ALERT
set AlertSQL= 'exec e_Report.dbo.FTX_FA_Aging_Report_sp ''FACloedAgingReport'''
where AlertID = 9330 ;
有点迷惑,不过''''
是一个带单引号的字符串。两个单引号在一起就是一个单引号。因此:
'exec e_Report.dbo.FTX_FA_Aging_Report_sp ''FACloedAgingReport'''
^ starts a string
------------------------------------------^ two quotes are single quote in the string
--------------------------------------------------------------^ two quotes are single quote in the string and then one more to end the string itself
检查您的报价定位。您需要在引用字符串的两端加上一对单引号,以及整个查询的引号。
'exec ee_Report.dbo.FTX_FA_Aging_Report_sp ''FACloedAgingReportSee'''
目前你有三个前两个后,根据戈登的回答应该是相反的。
我想在现有 table 的 AlertSQL 列中插入“exec e_Report.dbo.FTX_FA_Aging_Report_sp 'FACloedAgingReport'”。
我的更新脚本会怎样?
我的更新脚本如下:
update dbo.F_ALERT
set AlertSQL= 'exec e_Report.dbo.FTX_FA_Aging_Report_sp '''FACloedAgingReport''
where AlertID=9330
为什么它没有给我预期的结果。 提前致谢!!
你需要更多的引语和东西:
update dbo.F_ALERT
set AlertSQL= 'exec e_Report.dbo.FTX_FA_Aging_Report_sp ''FACloedAgingReport'''
where AlertID = 9330 ;
有点迷惑,不过''''
是一个带单引号的字符串。两个单引号在一起就是一个单引号。因此:
'exec e_Report.dbo.FTX_FA_Aging_Report_sp ''FACloedAgingReport'''
^ starts a string
------------------------------------------^ two quotes are single quote in the string
--------------------------------------------------------------^ two quotes are single quote in the string and then one more to end the string itself
检查您的报价定位。您需要在引用字符串的两端加上一对单引号,以及整个查询的引号。
'exec ee_Report.dbo.FTX_FA_Aging_Report_sp ''FACloedAgingReportSee'''
目前你有三个前两个后,根据戈登的回答应该是相反的。