IF EXISTS (select 1 from sys.objects where name = 'Users') begin -- maybe this IF is redundant. if exists ( select 1 from sys.tables t join sys.columns c on c.object_id = t.object_id where t.name = 'Users' and c.name = 'UserName') begin exec sp_RENAME 'Users.UserName', 'LoginName' , 'COLUMN' end end GO
"Rename column"
No comments yet. -