How do I use sp_MSforeachtable procedure to rewrite the script below? (or another way to loop through this instead of listing each command separately?)
insert into KSN001.WI_OCC_DATA select * from KSN000.WI_OCC_DATA where state_cd='01';
insert into KSN002.WI_OCC_DATA select * from KSN000.WI_OCC_DATA where state_cd='02';
insert into KSN003.WI_OCC_DATA select * from KSN000.WI_OCC_DATA where state_cd='03';
insert into KSN004.WI_OCC_DATA select * from KSN000.WI_OCC_DATA where state_cd='04';
insert into KSN005.WI_OCC_DATA select * from KSN000.WI_OCC_DATA where state_cd='05';