Ah,

Taking the 1024 out of single quotes worked.



From: Dzikowski, Michael
Sent: Tuesday, September 17, 2013 2:52 PM
To: [email protected]
Subject: RE: OT: Noob SQL Question (Conversion failed when converting the 
nvarchar value 'Not-Detected' to data type int.)

Any thoughts on why I'm getting these values returned?

[cid:[email protected]]


Looks like the <= isnt working ?



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Dzikowski, Michael
Sent: Tuesday, September 17, 2013 2:42 PM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] RE: OT: Noob SQL Question (Conversion failed when converting 
the nvarchar value 'Not-Detected' to data type int.)

I was all over the map there, trying different things I was finding on google...

Thanks!


From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of 
[email protected]<mailto:[email protected]>
Sent: Tuesday, September 17, 2013 2:14 PM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] RE: OT: Noob SQL Question (Conversion failed when converting 
the nvarchar value 'Not-Detected' to data type int.)

CurrentValue is defined as a nVarchar(max).... So,

  CurrentValue <= 1024 and
  CurrentValue <> '%Not%' and
  CurrentValue <> 'NULL'

Is wrong for a few reasons...

-- needs to be a check of a character, try wrapping the 1024 in single quotes

  CurrentValue <= '1024'

-- not sure why this is here?
  CurrentValue <> '%Not%'

-- if you are trying to exclude NULL values, this would be the proper syntax.
  CurrentValue IS NOT NULL

In summary, try changing your criteria to:
  CurrentValue <= '1024'
AND   CurrentValue IS NOT NULL





From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Dzikowski, Michael
Sent: Tuesday, September 17, 2013 11:04 AM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] OT: Noob SQL Question (Conversion failed when converting the 
nvarchar value 'Not-Detected' to data type int.)

I'm trying to get around this:


Error

Conversion failed when converting the nvarchar value 'Not-Detected' to data 
type int.


SELECT *
      ,[Netbios_Name0]
      ,[Description]
      ,[SettingType]
      ,[SettingDescriptionRID]
      ,[RuleNameRID]
      ,[CurrentValue]
      ,[ContributingRules]
  FROM [CM_CAS].[dbo].[v_CIComplianceStatusDetail]

  Where RuleNameRID = 'ID-d9a2c1c2-b45e-4d8e-971a-5ddef2720827'
  and
  CurrentValue <= 1024 and
  CurrentValue <> '%Not%' and
  CurrentValue <> 'NULL'


I just want to find all systems that have the Current Value <= 1024


I tried something that isn't working,

  CurrentValue <> '%Not%' and
  CurrentValue <> 'NULL'

Conversion failed when converting the nvarchar value 'Not-Detected' to data 
type int.

Is there a way to get around that?








<<inline: image001.png>>

Reply via email to