Question

I've got a table with a list of contracts:

CT-12345, CT-12346, CT-12347, CT-12347-B1, CT-12560-A1, etc. etc.

I need a where statement where it'll exclude anything that has a -... at the end of the contract. A '%-%' would exclude the first 3 as well but in my final output, from the above example, CT-12347-B1 and CT-12560-A1 would be excluded while CT-12345, CT-12346, CT-12347 would be included. I'm using SQL Server R2. Thoughts?

Thanks,

Joshua

Was it helpful?

Solution

Try this:

WHERE contract NOT LIKE '%-%-%'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top