Carl Carl - 1 year ago 97
SQL Question

Edit sql field type

I have a table who is filled by thousands of registers, so I donĀ“t want to affect them. I want to change type of column:


Id int(Primary key)
Hours decimal(18,0)

in SQL I can just add design table and changed it manually, but I need to change it with script code to get something like

Hours decimal(18,2) //instead (18,0)

How can I make this change without sql designer?

Answer Source

You can use alter table

ALTER TABLE TrainingHours ALTER COLUMN Hours decimal(18,2)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download