How do I convert all smallint type columns from my database to bit types?
I am using SQL Server 2008.
How do I convert all smallint type columns from my database to bit types?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In SQL Server you can do it with
ALTER TABLE my_table ALTER COLUMN my_column [new_datatype].Be careful of things like default values because I haven’t tested with them.
Example 1 – will give a list of queries for you to review / amend / execute (safer option).
Example 2 – will execute (recommend running example 1 first!)