Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HEllo Team,

I have the following Query.

SQL
select  ID,CUSTOMERLOANOCRID,FILELOGID,[FILENAME],BATCHID,RECORDNO,FIRSTNAME,
MIDDLENAME,LASTNAME,GENDER,FULLADDRESS,CUSTOMERADDR1,CUSTOMERADDR2,LANDMARK,CITY,STATE,
    PINCODE ,   LANDLINENO,     MOBILENO1 , MOBILENO2 , EMAILID ,   DOB ,   ADDRVERIFY ,
    PHOTOVERIFY ,   LOAN1AMT ,  LOAN1INTRRATE, LOAN2AMT,LOAN2INTRRATE,DATEOFEMI,RELEASEDATE,
    MOTHERNAME ,    HOUSETYPE ,COMPANYNAME,SALARY,IMAGENAME ,   IMAGERECORDNO,  QCTOVERIFY ,
    QCUSERID ,  CREATEDBY , CREATEDON , UPDATEDBY , UPDATEDON , DELETED ,QCUSERID ,QCTOVERIFY,
QCTOVERIFYREMARKS from CUSTOMERLOANDATA with(nolock)
where FILELOGID=(select top(1) filelogid  from CUSTOMERLOANDATA with(nolock)
 where  isnull (QCTOVERIFY , 0) and QCUSERID = 13 order by id asc) and isnull (QCTOVERIFY, 0)


I am getting the error
SQL
Msg 4145, Level 15, State 1, Line 9
An expression of non-boolean type specified in a context where a condition is expected, near 'and'


Kindly tell me where i am making the mistake.

Thanks
Harshal Raut
Posted

You have no condition in the ISNULL part. ISNULL does not returns a true or false id the column passed to it is null, rather the second parameter.
In your case
SQL
ISNULL(QCTOVERIFY, 0)

Will return the value of QCTOVERIFY if it's not null and 0 it it is null.
So you have to change your ISNULL question like this:
SQL
ISNULL(QCTOVERIFY, 0) = 0
if you check for null
SQL
ISNULL(QCTOVERIFY, 0) <> 0
if you check for non-null
 
Share this answer
 
Comments
R Harshal 10-Feb-14 2:53am    
Thanks Buddy... for your quich response.
R Harshal 10-Feb-14 2:53am    
*quick
SQL
select * from table where  QCTOVERIFY is null 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900