September 15, 2011 at 9:13 am
Does anyone know of a way to modify the Templates that are used in the "Script <object> as" submenu? (when you right click an object in object explorer, then go into the "Script <insert object> as")
September 15, 2011 at 9:36 am
September 15, 2011 at 9:46 am
Jared you're the man!
September 15, 2011 at 10:09 am
actually no luck. even when i change the template it still just encapsulates the SP in sp_executesql
USE [DB]
GO
/****** Object: StoredProcedure [dbo].[proc] Script Date: 09/15/2011 11:04:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[proc]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
ALTER PROCEDURE [dbo].[proc]
AS
BEGIN
....
END
'
END
GO
I don't know what happened but suddenly it changed to this format, and can't get it to return to the way it was, even after I edit the templates Jared pointed out
September 15, 2011 at 10:16 am
Hmm... What exactly did you do? Did you edit an existing template file or did you create a custom one?
Jared
Jared
CE - Microsoft
September 15, 2011 at 10:19 am
I'm 85% sure you guys are not talking about the same template concept.
1 talks about scripting and the other one talks about user made scripts you can edit with parameters (like in the link).
I don't know if / how to do the former.
September 15, 2011 at 10:24 am
Ninja's_RGR'us (9/15/2011)
I'm 85% sure you guys are not talking about the same template concept.1 talks about scripting and the other one talks about user made scripts you can edit with parameters (like in the link).
I don't know if / how to do the former.
I believe Ninja is correct.
September 15, 2011 at 10:28 am
I see... Maybe this will help you: http://www.karaszi.com/SQLServer/info_generate_script.asp
Thanks,
Jared
Jared
CE - Microsoft
September 21, 2011 at 10:30 am
If anyone cares, I found out the problem.
SSMS Menu -> Tools -> Options
In the left window click on the SQL Server Object Explorer branch > Scripting
In the list on the right, under Object scripting options set the choice for "Include IF NOT EXISTS clause" to false
September 21, 2011 at 10:38 am
Gabriel P (9/21/2011)
If anyone cares, I found out the problem.SSMS Menu -> Tools -> Options
In the left window click on the SQL Server Object Explorer branch > Scripting
In the list on the right, under Object scripting options set the choice for "Include IF NOT EXISTS clause" to false
Great! Thanks for posting the solution 🙂
Jared
Jared
CE - Microsoft
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply