Carl Carl - 4 months ago 59
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?


You can use alter table

ALTER TABLE TrainingHours ALTER COLUMN Hours decimal(18,2)