Doubt in Like Operator

General
Enthusiast

Doubt in Like Operator

Hello,

 While fetching information from dbc.columns, I am using a filter condition in the where clause - databasename like 'H%DB'. It should retrieve details of all  those databases that starts with H and ends with DB with any number of characters in between. However, the query is returning result for only one database and not for all the databases that starts with H and ends with DB. Any clue what is happening here? or am i missing some basic concepts of Like operator :)

1 REPLY
Enthusiast

Re: Doubt in Like Operator

Try to trim the databasename

SEL * FROM DBC.Columns

WHERE TRIM(DatabaseName) LIKE 'H%DB'

If you are getting only one database then it's the only one