SELECT dc.type, dc.type_desc,I.DATA_TYPE, 'ALTER TABLE public."'+ OBJECT_NAME(parent_object_id) + '" ALTER COLUMN "' + c.name + '" SET DEFAULT' + CASE WHEN I.DATA_TYPE='bit' THEN CASE WHEN REPLACE(REPLACE(definition,'(',' '),')','') = 0 THEN ' false' ELSE ' true' END WHEN I.DATA_TYPE='datetime' THEN ' NOW()' WHEN I.DATA_TYPE='smalldatetime' THEN ' NOW()' WHEN I.DATA_TYPE='smallint' THEN REPLACE(REPLACE(REPLACE(definition,'(',' '),')',''),'N','') ELSE REPLACE(REPLACE(definition,'(',' '),')','') END+';' FROM sys.default_constraints dc INNER JOIN sys.columns c ON dc.parent_object_id = c.object_id AND dc.parent_column_id = c.column_id INNER JOIN INFORMATION_SCHEMA.COLUMNS I ON I.Table_Name=OBJECT_NAME(parent_object_id) AND I.COLUMN_NAME=c.name WHERE OBJECT_NAME(parent_object_id)IN ('Access_Log', 'AdayLogDB', 'AdayLogDBDuplicateRecords', 'AlinanEgitimDB', 'ALoginDB', 'ApiErrorMessage', 'ApiErrorMessage_Translation', 'ApplicationRelavencyPoints', 'ApplicationView', 'AuthorizationModule', 'AuthorizationPermission', 'AuthorizationRole', 'AuthorizationRolePermission', 'AuthorizationUserRole', 'AvHaklariFirmaDB', 'AvHaklariKullaniciDB', 'CandidateJobApplicationStatus', 'CCingilTanimDB', 'CevapOranDB2', 'CityJobsdb', 'CityJobsHistoryDB', 'CJobSkinsDB', 'ClientCommentDelLogDB', 'ClientCommentLogDB', 'ClientsDB')