这个我的查询在执行请帮助时我遇到问题。 [英] This My Query I Am Facing Problem While Executing Please Help.

查看:54
本文介绍了这个我的查询在执行请帮助时我遇到问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 选择 A.int_ApplicantId,A.vch_UniqueRefNo,A.vch_ApplicantName, case  int_Gender 
1 然后 ' 男性 何时 < span class =code-digit> 2 ' 女性 结束 as 性别,vch_CorHouseNo,
(< span class =code-keyword> select vch_DistrictName 来自 M_District 其中 int_DistrictID = A. int_CorDistID
int_StateID = A.int_CorStateID)区,vch_CorPinCode,dtm_DOB,( case int_CategoryId
1 然后 ' UR' 2 然后 ' SC' 3 ' ST' 4 然后 ' SEBC' end )类别,
case isnull(bit_PHOH, 0 1 然后 ' 是' else ' No' end )PWD,( case isnull(bit_SportsPerson, 0
1 ' 是' else ' 否' 结束)SportsPerson,( case isnull(bit_ESM, 0 1
然后 ' 是' 否则 ' No' end )ESM,(< span class =code-keyword> case isnull(bit_Odia, 0 < span class =code-digit> 1 ' 是' else ' 否' 结束)Odia,
选择 vch_DDNO from T_Finance_Details F 其中​​ isnull(F.bit_DeletedFlag, 0 )= 0
F.vch_uniquerefno = A.vch_uniquerefno)vch_DDNO,A.vch_CorMobileNo
case vch_Remarks 何时 null 然后
选择 vch_Remarks 来自 T_CAF_Receive C 其中​​ C.vch_UniqueRefNo = A.vch_UniqueRefNo
ISNULL(c.bit_DeletedFlag, 0 )= 0) else coalesce =((选择 vch_remarks M_Remark_Detail 其中
int_Remark_id 中的class =code-keyword>(选择 val 来自 UDF_Split(选择 vch_Remarks 来自 T_Caf_Receive C
其中 C .vch_UniqueRefNo = A.vch_UniqueRefNo ISNULL(C.bit_DeletedFlag, 0 )= 0))) end
As vch_Remarks
,( case isnull(A.bit_ReceiveStatus, 0 何时 1 然后 ' 1' else ' 0' end )ReceiveStatus
来自 T_ApplicantDetails_Temp A 其中 isnull(A.bit_DeletedFlag, 0 )= 0 ISNULL(A.bit_ReceiveStatus, 0 )= 1
ISNULL(A.bit_Rejected, 0 )= 1 isnull( A.bit_DuplicateStatus, 0 )= 0 A.vch_AdvertisementNo = ' 2395'
A.vch_Post_Code = ' 35' order by A.vch_UniqueRefNo





我收到以下错误

Msg 102,15级,状态1,行13

'='附近的语法不正确。

消息156,级别15,状态1,行14

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

消息102,等级15,状态1,行15

')'附近的语法不正确。

解决方案

问题出在脚本的下面部分。您正在添加一个等于合并之后,我也会看到一些额外的括号。我相信你可以从这里开车。



  ELSE   coalesce  =(

SELECT vch_remarks
FROM M_Remark_Detail
WHERE int_Remark_id IN
SELECT val
FROM UDF_Split( SELECT vch_Remarks FROM T_Caf_Receive C WHERE C.vch_UniqueRefNo = A.vch_UniqueRefNo
AND ISNULL(C.bit_DeletedFlag, 0 )= 0

END
AS vch_Remarks
,(
CASE isnull(A.bit_ReceiveStatus, 0
WHEN 1
那么 ' 1'
ELSE ' 0'
END
)ReceiveStatus FROM T_ApplicantDetails_Temp WHERE isnull(A.bit_DeletedFlag, 0 ) = 0
AND ISNULL(A.bit_ReceiveStatus, 0 )= 1
AND ISNULL(A.bit_Rejected, 0 )= 1
AND isnull(A.bit_DuplicateStatus, 0 )= 0
AND A.vch_AdvertisementNo = ' 2395 '
AND A.vch_Post_Code = ' 35' ORDER BY A.vch_UniqueRefNo


select A.int_ApplicantId,A.vch_UniqueRefNo,A.vch_ApplicantName,case int_Gender
 when 1 then 'Male' when 2 then 'Female'  end as Gender,vch_CorHouseNo,
(select vch_DistrictName from M_District where int_DistrictID=A.int_CorDistID
 and int_StateID=A.int_CorStateID)District,vch_CorPinCode,dtm_DOB, (case int_CategoryId
 when 1 then 'UR' when 2 then    'SC' when 3 then 'ST' when 4 then 'SEBC' end)Category,
  (case isnull(bit_PHOH,0) when 1 then 'Yes' else 'No' end ) PWD,(case isnull(bit_SportsPerson,0)
   when 1 then  'Yes' else 'No' end ) SportsPerson,(case isnull(bit_ESM,0)  when 1
   then 'Yes'    else 'No' end ) ESM, (case isnull(bit_Odia,0) when 1 then 'Yes' else 'No' end ) Odia,
    (select vch_DDNO from T_Finance_Details F where isnull(F.bit_DeletedFlag,0)=0 and
     F.vch_uniquerefno=A.vch_uniquerefno)vch_DDNO,A.vch_CorMobileNo
     ,  case vch_Remarks when null then
    (select vch_Remarks from T_CAF_Receive C where C.vch_UniqueRefNo=A.vch_UniqueRefNo
     and ISNULL(c.bit_DeletedFlag,0)=0)else coalesce=((select  vch_remarks From M_Remark_Detail where
     int_Remark_id in(Select val from UDF_Split(Select vch_Remarks from T_Caf_Receive C
     where C.vch_UniqueRefNo=A.vch_UniqueRefNo and ISNULL(C.bit_DeletedFlag,0)=0))) end )
    As vch_Remarks
     ,(case isnull(A.bit_ReceiveStatus,0) when 1 then  '1' else '0' end ) ReceiveStatus
     from T_ApplicantDetails_Temp A  where isnull(A.bit_DeletedFlag,0)=0 and ISNULL(A.bit_ReceiveStatus,0)=1 and
     ISNULL(A.bit_Rejected,0)=1 and isnull(A.bit_DuplicateStatus,0)=0 and A.vch_AdvertisementNo='2395'
     and A.vch_Post_Code='35' order by A.vch_UniqueRefNo



I am getting following errors
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near '='.
Msg 156, Level 15, State 1, Line 14
Incorrect syntax near the keyword 'Select'.
Msg 102, Level 15, State 1, Line 15
Incorrect syntax near ')'.

解决方案

Problem is at the below part of the script. You are adding one equal to after coalesce and I see some extra parenthesis as well. I am sure you can drive from here.

ELSE coalesce = (
				(
					SELECT vch_remarks
					FROM M_Remark_Detail
					WHERE int_Remark_id IN (
							SELECT val
							FROM UDF_Split(SELECT vch_Remarks FROM T_Caf_Receive C WHERE C.vch_UniqueRefNo = A.vch_UniqueRefNo
									AND ISNULL(C.bit_DeletedFlag, 0) = 0)
							)
					) END
				) AS vch_Remarks
			,(
				CASE isnull(A.bit_ReceiveStatus, 0)
					WHEN 1
						THEN '1'
					ELSE '0'
					END
				) ReceiveStatus FROM T_ApplicantDetails_Temp A WHERE isnull(A.bit_DeletedFlag, 0) = 0
			AND ISNULL(A.bit_ReceiveStatus, 0) = 1
			AND ISNULL(A.bit_Rejected, 0) = 1
			AND isnull(A.bit_DuplicateStatus, 0) = 0
			AND A.vch_AdvertisementNo = '2395'
			AND A.vch_Post_Code = '35' ORDER BY A.vch_UniqueRefNo


这篇关于这个我的查询在执行请帮助时我遇到问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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