SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to change how SSMS Scripting generates code


How to change how SSMS Scripting generates code

Author
Message
YSLGuru
YSLGuru
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4710 Visits: 1667
Currently when I use SSMS 2005 to generate a CREATE script of an existing object by right-clicking the Object and selecting :

Script OBJECT As--->CREATE To

the resulting Query Window has a CREATE Object statement that uses the sp_executesql @statement SP where @statement is the complete T-SQL for creating the object. I want to get the script to not use the sp_ExecuteSQL SP but provide just the CREATE OBJECT T-SQL.

Is there anyway like a Scripting option in SSMS to get it to not use the sp_ExecuteSQL SP in the script it generates? I swear it use to generate scripts without using sp_ExecuteSQL and I don't know when this changed I just know I'd like to revert it back to the way it used to work.

NOTE: I have recently installed SQL Server 2008 (Tools & DB Engine) and kept my SQL 2005 DB Engine & Tools so I'm not sure if installing 2008 perhaps made some change that affected 2005 tools.

Thanks

Kindest Regards,

Just say No to Facebook!
RBarryYoung
RBarryYoung
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: General Forum Members
Points: 36524 Visits: 9518
Typically, the Scripter has to use Dynamic SQL like this when the "Include IF NOT EXISTS" option is set.

Turn that off and you should see hardly any dynamic SQL in your scripts.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
YSLGuru
YSLGuru
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4710 Visits: 1667
Setting Include IF NOT EXISTS clause to False did the trick.

Thanks!

Kindest Regards,

Just say No to Facebook!
RBarryYoung
RBarryYoung
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: General Forum Members
Points: 36524 Visits: 9518
Glad I could help!

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search