I have created a table in sql server which holds names of tables in the database and some other information. When I run this query
SELECT upper(TABLE_NAME) TABLE_NAME, ISNULL(syn_schema,'N') syn_schema, isnull(syn_data,'N') syn_data
FROM information_schema.tables
left join sync_config on TABLE_NAME = TAB_NAME
where table_type = 'BASE TABLE'
ORDER BY TABLE_NAME
this returns data from the information_schema.tables but not from the sync_config tables. syn_schema and syn_data columns are in the sync_config table. To summarize, join is not working on both tables. I have tried by changing datatype of tab_name column in sync_config table to SYSNAME from VARCHAR.
Thanks
Well, if the join is not working, that indicates that
TABLE_NAME = TAB_NAMEis never true. Check the table name fields to see if they really contain what you expect. Do they match exactly, including case (even though SQL is case-insensitive when referring to a table in a query, a string comparison of table names may* be case sensitive)?Beyond that, post the structure and sample data of your tables for more help.
*Thanks Martin Smith.