t-sql替换双引号
我有一个像 Replace(field,'\''','\"')
这样的 t-sql 语句,因为我有两个不同的结果 ''field1'' 和“field2”,但是如果我认为这两个不同的结果相同并想要将它们分组怎么办? 我选择通过用第二种样式替换第一个双引号来对这两个引号进行分组,但尽管替换了它们,但它们并不被解释为相同类型的引号。
我在这里缺少什么?
编辑:我正在尝试对文本相同但引号不同的数据进行分组,用户输入两个单引号“hello”和一个双引号“hello”,如果我有这两行,我试图将它们显示为一行作为“你好”,所以通过执行上面的语句我认为我应该能够做到这一点,但即使没有斜杠它也无法正常工作。
I have a t-sql statement like Replace(field,'\''','\"')
because i have two different results
''field1'' and "field2" but what if i consider those two different results the same and want to group them. I choose to group those two by replacing the first double quotes with the second style but although replaced they are not interpreted as the same type of quote.
What I am missing here??
Edited: I am trying to group data where text is the same but quotes differ, user is entering two single quotes ''hello'' and one double quote "hello", if I have this two rows I am trying to display them as one as "hello", so by executing the above statement I think I should be able to do this, but it isn't working properly even without slashes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下这段代码:
这是输出:
SQL Server does not escapequotes with斜杠,单引号是用另一个单引号转义的。 这将打印一个单引号:
这将打印两个单引号:
look at this code:
here is the output:
SQL Server does not escape quotes with slashes, a single quote is escaped with another single quote. This will print one single qoute:
this will print two single quotes: