存储过程中用到的replace函数
在sql语句中selectid,replace(filepath,'http://123.111.11.11:8080/sxcg/upimage/','/upimages...
在sql语句中
select id,replace(filepath,'http://123.111.11.11:8080/sxcg/upimage/','/upimages/') as filepath,cudate from b_project_file
是可以成功执行的
但是在存储过程中(片段)(去掉replae这块可以正常执行)
set @Query = @Query+ '
select filestate ,replace(filepath,'http://11.111.11.11:8080/szcg/upimage','upimages/') as filepath,cudate
from '+@vcDB+'b_project_file WITH (NOLOCK)
where projcode = '+@projcode +'
order by id desc'
就出问题:消息102,级别15,状态1.;'/'附近有语法错误
求解释和帮助 谢谢了
数据库是sql2005
不存在中文空格问题 我重打了好几遍 展开
select id,replace(filepath,'http://123.111.11.11:8080/sxcg/upimage/','/upimages/') as filepath,cudate from b_project_file
是可以成功执行的
但是在存储过程中(片段)(去掉replae这块可以正常执行)
set @Query = @Query+ '
select filestate ,replace(filepath,'http://11.111.11.11:8080/szcg/upimage','upimages/') as filepath,cudate
from '+@vcDB+'b_project_file WITH (NOLOCK)
where projcode = '+@projcode +'
order by id desc'
就出问题:消息102,级别15,状态1.;'/'附近有语法错误
求解释和帮助 谢谢了
数据库是sql2005
不存在中文空格问题 我重打了好几遍 展开
2个回答
展开全部
set @Query = @Query+ '
select filestate ,replace(filepath,''http://11.111.11.11:8080/szcg/upimage'',''upimages/'') as filepath,cudate
from '+@vcDB+'b_project_file WITH (NOLOCK)
where projcode = '+@projcode +'
order by id desc'
把字符串的单引号改成两个单引号
select filestate ,replace(filepath,''http://11.111.11.11:8080/szcg/upimage'',''upimages/'') as filepath,cudate
from '+@vcDB+'b_project_file WITH (NOLOCK)
where projcode = '+@projcode +'
order by id desc'
把字符串的单引号改成两个单引号
展开全部
set @Query = @Query+ 'select filestate ,replace(filepath,\'http://11.111.11.11:8080/szcg/upimage\',\'upimages/\') as filepath,cudate from '+@vcDB+'b_project_file WITH (NOLOCK) where projcode = '+@projcode +' order by id desc'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询