Hi all,

DANIWEB saved me a few months ago, and I'm hoping the community can save me again :)

I've found myself in the position of needing to extract a very small portion of data from a vast SQL database.

I've got the specific table in question, and have isolated what was needed out of the query itself.

However, my problem is this:

When I run the query

SELECT TOP 100000 [typeID]
  FROM [ebs_DATADUMP].[dbo].[invTypes]

I get a whole host of entries in some fields that have a NULL entry, specifically the marketgroupID column. I need an amendment to the script that would behave like:

if [marketGroupID]=NULL then Ignore_Row

And (yes, and) if [typeName] has the word "Blueprint" in it, to also ignore that row.

I realise this might be a bit much to ask, but any help or guidance will be massively appreciated.



I've now amended my own script to this point:

SELECT TOP 100000 [typeName]
  FROM [ebs_DATADUMP].[dbo].[invTypes]
  delete from [ebs_DATADUMP].[dbo].[invTypes]
  where ebs_datadump.dbo.invTypes.marketGroupID='NULL'

But I'm getting this error:

Conversion failed when converting the varchar value 'NULL' to data type smallint.

Now this would be due to the marketGroupID being an integer field, but how do I quantify a null entry in an integer?



sorted it, had the wrong end of the stick syntax wise,

where ebs_datadump.dbo.invTypes.marketGroupID is NOT NULL


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.