简体   繁体   中英

Modify stored procedure functionality is outputting the Alter stmt as dynamic SQL

Just recently my SSMS changed and it's driving me crazy. Normally when you right click on a stored procedure and select "Modify", it outputs the stored procedure code as a bunch of SQL statements.

Starting yesterday, mine now outputs a giant sp_executesql statement (see screenshot). What setting controls this?? Using v 18.12.1

在此处输入图像描述

This is happening because of the existence check before the code creation of your procedure setting is enabled.

To control this behavior follow the steps.

  1. From the menu option, click " Tools > Options ".
  2. On the left side, expand " SQL Server Object Explorer " and choose " Scripting "
  3. On the right-hand side, under the group " Object Scripting Options " change the setting " Check for object existence " to false.

在此处输入图像描述

Tested on v18.4

Not sure what settings need to be changed. Alternatively, you can click script procedure as -> alter to -> new query window
check this image

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM