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]] On 
Behalf Of Dzikowski, Michael
Sent: Tuesday, September 17, 2013 11:04 AM
To: [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?






Reply via email to