1

I want to make a query witch select only field doesn't contains the percent symbol "%".

this field takes values like 1, 1,5, 1,5%. I want select only 1 and 1,5 in this example.

my query is :

SELECT * FROM CommissionContract 
WHERE commission DOESN'T CONTAINS THE SYMBOL "%"
TT.
  • 15,774
  • 6
  • 47
  • 88
amine
  • 373
  • 1
  • 5
  • 12
  • I'm using sql server. – amine Jul 08 '20 at 15:17
  • 1
    see this answer: https://stackoverflow.com/a/14518639/6794089 – bman7716 Jul 08 '20 at 15:29
  • Does this answer your question? [Escape Character in SQL Server](https://stackoverflow.com/questions/5139770/escape-character-in-sql-server) – bman7716 Jul 08 '20 at 15:31
  • Ref: [Pattern Matching with the ESCAPE Clause](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/like-transact-sql?view=sql-server-ver15#pattern-matching-with-the-escape-clause). – HABO Jul 08 '20 at 16:54

2 Answers2

0

try with not like

SELECT * FROM CommissionContract 
WHERE commission NOT LIKE '%[%]%'
zealous
  • 7,336
  • 4
  • 16
  • 36
0

Use the operator NOT LIKE to exclude the values that contain the char '%'

SELECT * FROM CommissionContract 
WHERE commission NOT LIKE '%[%]%'

See the demo.

forpas
  • 160,666
  • 10
  • 38
  • 76