This question already has an answer here:
这个问题在这里已有答案:
- How do I escape a single quote in SQL Server? 9 answers
如何在SQL Server中转义单引号? 9个答案
Iam having an error when Iam trying to add a data in the SQL Server DB Engine Query, here is my code:
Iam尝试在SQL Server数据库引擎查询中添加数据时出错,这是我的代码:
INSERT INTO tbl_product(PartNumber, Brand, Description, UnitPrice, SellingPrice, UnitofMeasure, Quantity, CategoryId, IsActive) VALUES
('AK4182', 'ADR', '2 ROWS TYPE Z CITY 99' MANUAL',1845,2255,'PCS',0, 1, 0);
the error is because I have a ' in my description value "2 ROWS TYPE Z CITY 99' MANUAL.
错误是因为我有'在我的描述值'2 ROWS TYPE Z CITY 99'手册。
How can I add a this even with '?
我怎么能添加这个甚至'?
Thanks,
NicoTing
1 个解决方案
#1
0
You need to escape it with an extra single quote('
). For example:
你需要使用额外的单引号(')来逃避它。例如:
SELECT '2 ROWS TYPE Z CITY 99'' MANUAL':
#1
0
You need to escape it with an extra single quote('
). For example:
你需要使用额外的单引号(')来逃避它。例如:
SELECT '2 ROWS TYPE Z CITY 99'' MANUAL':