本文介绍了我如何在mySQL中创建一个QUOTENAME函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在mySQL中创建一个QUOTENAME()函数,就像存在于M $ SQL Server中的一样。
I would like to create a QUOTENAME() function in mySQL like the one that exists in M$ SQL Server.
这就是它的作用:
QUOTENAME returns a Unicode string with the delimiters added to make the input string a valid identifier. The QUOTENAME function uses this syntax:
QUOTENAME ( 'string' [ , 'delimiter' ] )
You pass QUOTENAME a string to be delimited and a one-character string to use as the delimiter. The delimiter can be a square bracket or a single or double quotation mark.
这甚至可能吗?
Is this even possible?
推荐答案
您可以从这样的事情开始 - 构建eggyal的评论
You could start with something like this - building off of eggyal's comment
DROP FUNCTION IF EXISTS QUOTENAME;
CREATE FUNCTION QUOTENAME (s varchar(50), d CHAR(1))
RETURNS VARCHAR(52)
RETURN CONCAT (d, REPLACE(s, d, CONCAT(d,d)), d);
然后添加您的特殊情况和其他功能。
And then add your special cases and additional functionality.
这篇关于我如何在mySQL中创建一个QUOTENAME函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!