开发者

What special characters I should escape in T-SQL strings?

What special characters I should escape in T-SQL (SQL Server) string?

SET @em开发者_开发技巧ail = ''alex_USA$info@example.com''

Fails.


If you want @email to have the value 'alex_USA$info@example.com', try:

SET @email = '''alex_USA$info@example.com'''


There should not be two single quotes in that query...

set @email = 'alex_USA$info@example.com'

will work just fine...

You'll need to escape single quotes, which is done by putting 2 single quotes. If for example you really wanted 'alex_USA$info@example.com' with the quotes in the database, you would replace ' with '' in the data, and still quote it:

set @email = '''alex_USA$info@example.com'''


No need for the second set of single quotes.

SET @email = 'alex_USA$info@example.com'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜