Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
动态SQL——嵌套的Replace()函数_Sql_Tsql_Dynamic Sql_Edi - Fatal编程技术网

动态SQL——嵌套的Replace()函数

动态SQL——嵌套的Replace()函数,sql,tsql,dynamic-sql,edi,Sql,Tsql,Dynamic Sql,Edi,我想替换项目描述中的特殊字符。这些数据正在转换为EDI,我在描述中没有~或* 下面的代码行吗?我有双刻度,因为它是动态SQL replace(replace(sd.item_desc,''*'',''''), sd.item_desc,''~'','''') item_desc 不,不行。试试这个: replace(replace(sd.item_desc, ''*'', ''''), ''~'', '''') item_desc replace的第一个参数是字符串,如您所知,因此您

我想替换
项目描述中的特殊字符。这些数据正在转换为EDI,我在描述中没有
~
*

下面的代码行吗?我有双刻度,因为它是动态SQL

replace(replace(sd.item_desc,''*'',''''),
    sd.item_desc,''~'','''') item_desc

不,不行。试试这个:

replace(replace(sd.item_desc, ''*'', ''''), ''~'', '''') item_desc

replace
的第一个参数是字符串,如您所知,因此您需要在外部
replace
中提供字符串,这将是内部
replace
返回的字符串。示例输入和输出将帮助您,谢谢!我知道语法不正确,只是看不见而已。