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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Modifying datatype

Author  Topic 

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-09-17 : 03:41:08
need to change the datatype of one column , however that column is refered with more column , also it has indexed. while doing the alter
getting error :

Msg 5074, Level 16, State 8, Line 1
The index 'rungradex0' is dependent on column 'facilityid'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE ALTER COLUMN facilityid failed because one or more objects access this column.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-17 : 03:42:35
First drop index, then alter column and recreate index again
Go to Top of Page

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-09-17 : 04:40:20
ok i do .. but how index refer with datatype ???? why column datatype has dependency with index column ???
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-17 : 04:44:24
quote:
Originally posted by niranjankumark

ok i do .. but how index refer with datatype ???? why column datatype has dependency with index column ???


the index is created on column. so whenever you alter column index has to dropped before and recreated after.
Go to Top of Page
   

- Advertisement -