Creates Script feature uses dbo.sp_executesql (ARRG!)
  Home FAQ Contact Sign in
microsoft.public.sqlserver.tools only
 
Advanced search
POPULAR GROUPS

more...

microsoft ... sqlserver.tools Profile…
 Up
Creates Script feature uses dbo.sp_executesql (ARRG!)         


Author: info
Date: Apr 15, 2008 12:34

Why does my SQL Management Studio use dbo.sp_executesql with my CREATE/
ALTER Script feature? It's a pain to have all of the single quotes and
what not in there... why doesn't it just scriptout the CREATE PROC
stement for example instead of :
EXEC dbo.sp_executesql @statement = N'

CREATE PROC [dbo].[p_myprocname]
.
.
.
'
Is there a setting I can set? I aquired this laptop install when I
started my new job and I've never seen this happen before.

Erik
4 Comments
Re: Creates Script feature uses dbo.sp_executesql (ARRG!)         


Author: Tibor Karaszi
Date: Apr 16, 2008 04:49

Can you explain exactly how you get to this script. I.e., where do you click, what menu do you
select? This way we can try to reproduce what you are seeing.

Also, did you update your SSMS? MS did lots of work (including scripting) in sp2.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
Show full article (0.97Kb)
no comments
Re: Creates Script feature uses dbo.sp_executesql (ARRG!)         


Author: info
Date: Apr 16, 2008 08:11

Right Mouse Click on Stored Procedure
Script Stored Procedure As...
CREATE...
New query window

Client Info from help..about.:

Microsoft SQL Server Management Studio 9.00.3042.00
Microsoft Analysis Services Client Tools 2005.090.3042.00
Microsoft Data Access Components (MDAC)2000.085.1117.00 (xpsp_sp2_rtm.
040803-2158)
Microsoft MSXML 2.6 3.0 5.0 6.0
Microsoft Internet Explorer 7.0.5730.13
Microsoft .NET Framework 2.0.50727.832
Operating System 5.1.2600
no comments
Re: Creates Script feature uses dbo.sp_executesql (ARRG!)         


Author: Tibor Karaszi
Date: Apr 16, 2008 19:18

I just tried those steps for a proc in the Adventureworks and my CREATE PROC was *not* encapsulated
inside sp_executesql. I douns that anything but the SSMS version would make a difference (and we
have the same SSMS version), but I've pasted my version list at the end of this post.

However, I think I found the setting. In SSMS, tools, options, scripting, "Include OF NOT EXIST
clause". Setting this to make my SSMS to wrap the CREATE PROC inside sp_executesql.

Microsoft SQL Server Management Studio 9.00.3042.00
Microsoft Analysis Services Client Tools 2005.090.3042.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 7.0.5730.11
Microsoft .NET Framework 2.0.50727.1433
Operating System 5.1.2600
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
Show full article (1.56Kb)
no comments
Re: Creates Script feature uses dbo.sp_executesql (ARRG!)         


Author: info
Date: Apr 16, 2008 23:10

> However, I think I found the setting. In SSMS, tools, options, scripting, "Include OF NOT EXIST
> clause". Setting this to make my SSMS to wrap the CREATE PROC inside sp_executesql.

*** ISSUE RESOLVED USING ABOVE INSTRUCTIONS ***

Thank you, Tibor!

Erik
no comments