Convert bit column to integer

Try using CAST(columnName AS INT) AS IntValue.

e.g.

SELECT columnName, CAST(columnName AS INT) AS IntValue
FROM table

OR you can use CONVERT(INT, columnName) AS IntValue.

UPDATE: If you need to alter the actual metadata of the table, then you first need to drop the constraints then alter the column:

i.e.

ALTER TABLE [Table] DROP CONSTRAINT [ConstraintName];
GO
ALTER TABLE [Table] ALTER COLUMN [ColumnName] INT;

Then recreate any constraints that you need.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)