select name as tableName from sys.tables where name like 'tbl[_]DW[_]DistributorAnalyzer[_]%' order by tablename alter table #tableName# drop constraint #_pkName# go alter table #tableName# alter column dataId bigint not null go alter table #tableName# add constraint #_pkName# primary key (ownerType, ownerId, dataId ) go