Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ramdas
Posting Yak Master
181 Posts |
Posted - 2003-12-16 : 13:48:25
|
| Hi Folks,Is there way to find out if there is a index on a computed column in a table. Also is there way to find out computed columns on all the tables in a database.Thank youRamdasRamdas NarayananSQL Server DBA |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-16 : 14:10:50
|
| This will write out the code needed to figure out if the column is computed or not:SELECT 'select COLUMNPROPERTY(OBJECT_ID(''' + TABLE_NAME + '''), ''' + COLUMN_NAME + ''', ''IsComputed'')'FROM INFORMATION_SCHEMA.COLUMNSRun the output. You will get a 1 if it is computed. I'll work on the index thing now.Tara |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-16 : 14:18:26
|
| I don't have any computed columns to test this (even in pubs and Northwind), but:SELECT OBJECT_NAME(id) AS TableName, COL_NAME(id, colid) AS ColumnNameFROM sysindexkeysWHERE COLUMNPROPERTY(id, COL_NAME(id, colid), 'IsComputed') = 1Tara |
 |
|
|
ramdas
Posting Yak Master
181 Posts |
Posted - 2003-12-17 : 13:45:49
|
| Hi Folks,Thanks for your help.Ramdas NarayananRamdas NarayananSQL Server DBA |
 |
|
|
|
|
|