In SQL Server. if you wanted addresses that contained characters other than alphanumerics and spaces:
address LIKE '%[^0-9a-zA-Z ]%';
noting the ^ character means "any single character not within the specified range". Not sure if something very similar is possible in DB2.
In SQL Server. if you wanted addresses that contained characters other than alphanumerics and spaces:
address LIKE '%[^0-9a-zA-Z ]%';
noting the ^ character means "any single character not within the specified range". Not sure if something very similar is possible in DB2.
Sure, look here. Also NOT LIKE is supported.
For negating output of like use operator NOT and place it before like as in your modified code.
Select top 1000 *
from TableName
where Column7 = 'ColumnValueImWatching'
and idx6 NOT like 'Keyword%'
order by ColumnthatIndicatesMostRecentRecords desc
You should use NOT LIKE:
and idx6 not like 'Keyword%'
but you should also decide how to handle null values, so you might have to use this:
and (
idx6 not like 'Keyword%'
or idx6 is null
)
since null is neither like 'Keyword%' nor not like 'Keyword%'
Hello, sorry if this is a dumb question but I would love some input if anyone can help.
I have a column called ‘service type’ . The values in this column are from a pick list that could be a combination of eight different values. Some of the values might just have one, some might have four, some might have all eight. It can be any variation of combination.
I need to select only the rows that contain the value: “Sourcing/Contracting”. The problem i am having is that another one of these values include the words: “Non Hotel Sourcing/Contracting”.
So my issue is that if I write a SQL statement that says LIKE “%Sourcing/Contracting%”, then that will also pull in rows that might ONLY include the value of “Non Hotel Sourcing/Contracting”.
So, regardless of whether or not the value of ‘Non Hotel Sourcing/Contracting’ is listed, I just need to ensure that ‘Sourcing/Contracted’ is listed in the values.
I hope this makes sense and if anyone can help, you would save my day. How do I say that I need only the rows that contain a certain value when that certain value is actually a part of another value? Nothing is working. Thank you in advance.
SOLVED! I’m sure many of these suggestions work but u/BrainNSFW give me a couple of options that I quickly was able to just tweak and they work perfectly. And just for the record I didn’t create this. I just started working at this place and just trying to get my reports to run properly. Glad to know it wasn’t just user error on my end. Thank you for being such a helpful group.🤍🤍🤍