Problem with Renaming a Column in SQL Server

前端 未结 4 1856
我寻月下人不归
我寻月下人不归 2020-12-19 13:49

So I was trying to rename a column in my table from Conversion_Fee_PerShare to just Conversion Fee.

I looked up online and found the syntax

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 14:38

    Never mind I found out:

    ALTER TABLE dbo.AllocationDetails
    DROP COLUMN [[Conversion_Fee]]]
    

    OR

    sp_RENAME 'dbo.AllocationDetails.[[Conversion_Fee]]]' , 'Conversion_Fee', 'COLUMN'
    

    these will work fine. :)

    Using Double Quotes:

    exec sp_rename 'dbo.AllocationDetails."[Conversion_Fee]"' , 'Conversion_Fee', 'COLUMN' 
    

    will also work.

提交回复
热议问题