2016-04-10 22 views
-2

我要插入一個查詢與撇號插入文本在SQL Server中的撇號

+0

英語中,請... –

+3

只是一些重複... http://stackoverflow.com/questions/8336812/way-to-insert-text-having-apostrophe-into-a-sql-table http://stackoverflow.com/questions/1912095/how-to-insert-a-value-that-c​​ontains-an-apostrophe-single-quote http://stackoverflow.com/questions/775687/how-to -insert-text-with-single-quotation-sql-server-2005 http://stackoverflow.com/questions/1586560/how-do-i-escape-a-single-quote-in-sql-server –

回答

1

不知道,如果你真的要問你的問題之前搜查,但也許你並沒有搜索正確的術語,我給你的疑點利益

你要找的是所謂逃離

在SQL Server中,你逃避一個單引號加倍

INSERT INTO mytable VALUES ('Here''s an example') 
+0

或你也可以*使用**參數**並解決這個問題(並避免在這個過程中進行SQL注入!) –

+0

@marc_s同意了,但我認爲這對於OP來說過於複雜了;-) –