Hi
I want to ge all fields from Sql Database which start with U_. I am trying below Sql Query but it is not returning any record.
SELECT
TABLE_NAME,
COLUMN_NAME
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
COLUMN_NAME LIKE 'U_%'
AND TABLE_SCHEMA = 'Pearl_Live';
Thanks
Emily FosterPosted May 7, 2025, 1:50 AM
It appears that your SQL query is not returning any records because the usage of `'U_%'` in your `LIKE` clause may not be matching the desired fields correctly.
When using `LIKE` in SQL, the `%` wildcard represents zero or more characters. To ensure that you get all fields that start with 'U_', you should use `'U\_%'` instead of `'U_%'`. The underscore `_` is a wildcard in SQL that represents a single character, so by adding a backslash before the underscore, you escape its special meaning and specify that you are looking for fields that start with 'U_' followed by any characters.
Here is the corrected SQL query for your scenario:
By making this adjustment, your query should now return all fields from the SQL database that start with 'U_'. Let me know if you encounter any further issues or if you need more clarification. Hope this helps!