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 |
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2005-09-20 : 11:13:07
|
| Hello All,I am trying to run a query to change the data type of a tablealter table A alter column lname varchar(100)i got below error: ALTER TABLE ALTER COLUMN lname failed because one or more objects access this column.Is there a way (using T-sql) to change data type and handle other relationship with table also?If i do it in enterprise manager - i'll get the message :" the following tables will be saved..." - all i have to do it click OK , it'll be saved and change the data type for me.Thanks for your help. |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-20 : 11:45:36
|
| If you click the Create Script button in Enterprise Manager when you do this you'll see E.M.'s script for the change.Like as not it will:Drop foreign keysPossibly Drop Constraints, Create temp table, Copy data into temp table, Drop original table, Rename Temp to Original name.If not it will "alter" the existing tableCreate foreign keysI just get E.M. to generate the script for me, abort the change without saving, and then use the script itself.Kristen |
 |
|
|
tocroi72
Yak Posting Veteran
89 Posts |
Posted - 2005-09-20 : 12:22:44
|
| i c - Thank Kristen |
 |
|
|
|
|
|