How to determine the Key columns of a view.

  • the INFORMATION_SCHEMA tables get me alot of information but i can't find anything to determine the key of a View. I can't rely on column names to relate to the base table columns (COLUMNS.COLUMN_NAME = VIEW_COLUMN_USAGE.COLUMN_NAME) because alias' and duplicate base column names would break that relation. Am i going to have to parse through the view definition or is there an easy way? If anyone has done this before (parsing or otherwise) and wouldn't mind sharing their solution I'd apreciate it.

    also note that i only need this info for updatable views, incase that makes a difference.

  • And to make that clear...

     you can update a view as long as you update one table at a time even though you can have more than one table included in the view!

     


    * Noel

  • well thx for the replies, guess i'll get started on parsing.  And i knew about the updatable view limitations...  I'm designing a datalayer which would know how to update a view by generating two or more separate statements...  in order to do that i need the key columns of the base tables, hence the question.

    thx again

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply