sql server存储过程中的语法错误 [英] syntax error in sql server stored procedure

查看:200
本文介绍了sql server存储过程中的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii all ..我的sql存储过程中出现错误.. plz help



我的sp的查询是:



hii all.. i m getting error in my sql stored procedure.. plz help

my sp's query is:


   SET @vQuery ='SELECT Child.gpmctc as gpmctc,Child.village as village ,Child.habitation as habitation,
 Child.cname as cname, Child.sex as sex,Child.dob as dob,Child.sch_code as sch_code,Child.class as class,
 Child.nereason as nereason,Child.droupout as droupout,Child.highclass as highclass
    FROM ' + @ChildTblName + ' As Child   
    WHERE  Child.distt = ' + @DistrictID + ' and   LTRIM(RTRIM(ISNULL(sch_code,'')))='' and  Child.block=' + @blockcode + ' and age>=6 and age<=14' 







错误:第15行,第15行,第1行,第5行

关键字'和'附近的语法不正确。



plz帮助提前感谢




error:Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'and'.

plz help thanks in advance

推荐答案

,'')))=''

这里有两个引号。

试试 ,'')))='


您好,

请检查以下查询,如果有帮助请告诉我。

Hi,
Please check the below query, and let me know if it helps.
SET @vQuery ='SELECT Child.gpmctc as gpmctc,Child.village as village ,Child.habitation as habitation,
 Child.cname as cname, Child.sex as sex,Child.dob as dob,Child.sch_code as sch_code,Child.class as class,
 Child.nereason as nereason,Child.droupout as droupout,Child.highclass as highclass
    FROM ' + @ChildTblName + ' As Child   
    WHERE  Child.distt = ' + @DistrictID + ' and   LTRIM(RTRIM(ISNULL(sch_code,'''')))='''' and  Child.block=' + @blockcode + ' and age>=6 and age<=14' 





谢谢,

Hitesh Varde



Thanks,
Hitesh Varde


尝试更换LTRIM(RTRIM(ISNULL) sch_code,'')))=''与LTRIM(RTRIM(ISNULL(sch_code,'''')))=''''
Try Replacing LTRIM(RTRIM(ISNULL(sch_code,'')))='' with LTRIM(RTRIM(ISNULL(sch_code,'''')))=''''


这篇关于sql server存储过程中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆