0

Id Name address 123 mona #13,Jainroad|Mh

Here i have to find commas and pipeline in address column Similarly i have to apply on different columns

Select * from table Where col1 like '%,%';

  • 1
    Please edit your question to include more detail. Can you clarify what "generic query" means? What do you need to do with rows that have comma or pipe (vertical bar) symbol - just return them as is? The `like` example does that. Where are you having difficulty? – Fred Apr 08 '21 at 14:36
  • I need to find out Delimiters in almost 50 tables. So i can't go and modify the query 50 times. I want the columns names to display which has delimiter in it as is. I tried using like operation but i have to list out all the columns names...is there any way without writing the columns names i could find the Delimiters ?? – Ambika Kheny Apr 08 '21 at 16:35
  • The short answer is no. If you want to examine values in a column you must name that column. You could use a script or stored procedure to query metadata (e.g. dbc.ColumnsV view) to obtain names of character columns and build the SQL statements for you, then execute those statements. – Fred Apr 08 '21 at 18:45
  • Thanks Fred for sharing your knowledge – Ambika Kheny Apr 09 '21 at 05:05
  • Select * from dob.email where email_Id like any ('%,%' , '%^%') or email_evnt like any ('%,%' , '%^%') ; when i run this query i am getting error "partial string matching requires character operands ...Can u help help me fred where i am going wrong – Ambika Kheny Apr 09 '21 at 10:28
  • Seems that one of the columns is not a CHAR / VARCHAR datatype. – Fred Apr 09 '21 at 14:59

0 Answers0