November 1, 2013 at 1:45 am
Hi Guys
It is easy to extract out indivisual objects from Any SQL DB. I have a scenario where have a new client and need to extract out all SQL SPs/Views/DDL/DML Scripts to Indivisual Files. BUT I NEED to ADD Following statements as the header<Statement> and footer<Footer> with all Objects being extracted out from SQL Server 2008R2.
Statement 1:
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = ' OBJECTNAME')
BEGIN
PRINT 'Dropping Procedure OBJECTNAME'
DROP Procedure OBJECTNAME
END
GO
Statement 2:
go
Grant Execute on OBJECTNAME to Username_Role
GO
I don;t think there is any way of doing this through SQL Server. You need to Write some piece of code in this regard. Can you please help me how to go for this or any other way to tackle this issue.
Your response in this regard will be highly appreciated.
Waseem Bukhari
CMer
November 1, 2013 at 2:29 am
Hi
In ssms right click on your database then choose [Tasks] and then [Generate scripts...] will open a window which will lead you to the goal.
Regards,
IgorMi
Igor Micev,My blog: www.igormicev.com
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply