参数化SQL,ORACLE VS的SQL Server与正规表示法 [英] Parameterized SQL, ORACLE vs SQL Server with regular expresion
问题描述
的Sql @ P1
使用p>
ORA :P1
我想用在我的SQL刚 @
并在这ORA数据库使用情况下,所有:
字符应该是<$ C $替换C> @ 。
您可以帮我创建正则表达式?
下面是一些例子SQL:
更新TEST_TABLE设置文本=:P1,其中文本='贾纳:克拉拉或SOME_VALUE =:值或信息=两节
类似的问题,替代解决方案,可以发现的这里。
正确正则表达式:
语句= Regex.Replace(声明@:(=(?:?'[^'] *' | [^'\\\
])* $),@);
Oracle and Sql server using different prefix for parameters in parametrized string.
Sql using @p1
ORA using :p1
I would like to use in my SQL just @
and in case that ORA database is used all :
character should be replaces with @
.
Can you please help me to create regular expression?
Here is some example SQL:
update test_table set text = :p1 where text = 'jana:klara' or some_value = :value or info = 'two'
Similar question and alternative solutions can be found here.
Correct regex:
statement = Regex.Replace(statement, @":(?=(?:'[^']*'|[^'\n])*$)", "@");
这篇关于参数化SQL,ORACLE VS的SQL Server与正规表示法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!