PDSWSS
asked on
How do you change a column name of a table in an SQL Server 2005 database?
I just successfully migrated the backend of an Access 2000 database into SQL Server 2005. Some of the column names in a couple of the tables were altered in the migration process and need to be changed. How do you alter a column name of a Table in a SQL Server 2005 database? Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you sure they have the exact same name? I don't think that's allowed and most likely it wouldn't let you rename in such a case. It will never let you create a table with columns that have the same name. can you script the table as create and post it here?
Thanks.
Thanks.
ASKER
After looking more closely I see I was mistaken - they are very similar but not exactly the same.
As soon as I get a chance I will try your alter column title suggestions.
Thanks,
As soon as I get a chance I will try your alter column title suggestions.
Thanks,
ASKER
It appears that SQL renamed 6 consecutive columns with the same name. However, the data appears to be in the correct order if the columns had their correct names.
According to your instructions I would need to rename 5 of these 6 columns with a different name before
I could change them each to the correct name since this command couldn't distinguish between 6 columns with the same name. Is there a better way to do this? Thanks,