3

I've noticed that while I can use %dictionary.compiledclass to get a table with schema names and table names, which allow querying for their existence, I cannot do the same for columns. I have yet to find the command that allows verifying whether a column exists or not, or retrieving numerous column names using LIKE "prefix%".

Is there even such a thing? Or an alternative?

2 Answers2

1

You can use %Dictionary.CompiledProperty table and SqlFieldName column of that table. For example to find out tables that have column 'ColumnName' you can use this query:

select parent->SqlTableName 
from %dictionary.compiledproperty 
where SqlFieldName='ColumnName'
adaptun
  • 494
  • 4
  • 11
  • Thanks! The problem here though is that I cannot correlate between tables and columns; that is to say, were I to have a "Content" column in more than one table, I could tell "Content" exists, but not in which table. – Ahab Lollington Sep 02 '13 at 07:05
  • You can this kind of query: `select parent->SqlTableName from %dictionary.compiledproperty where SqlFieldName='Column-name'` – adaptun Sep 02 '13 at 08:55
1

Execute this Query : select * from %dictionary.compiledproperty Where parent='TableName' and SqlFieldName='ColumnName' Check Row Count value ,0 not exist

chandru
  • 11
  • 1