[ad_1]
sp_MSforeachtable @command1="ALTER TABLE ? ADD id int IDENTITY PRIMARY KEY CLUSTERED"
The good thing is that it if it fails for some table, it doesn’t fail for all.
[ad_2]
solved How to add a primary key to all tables in SQL Server?
[ad_1]
sp_MSforeachtable @command1="ALTER TABLE ? ADD id int IDENTITY PRIMARY KEY CLUSTERED"
The good thing is that it if it fails for some table, it doesn’t fail for all.
[ad_2]
solved How to add a primary key to all tables in SQL Server?