Skip to content

[Bug]: Go to Definition (F12) opens existing stored procedures as CREATE instead of ALTER #22946

Description

@Henrikkebaby

Description

Description

Using Go to Definition (F12) on an existing stored procedure opens its definition as:

CREATE PROCEDURE dbo.ExistingProcedure

Because the procedure already exists, executing this script fails. An editable definition should use:

ALTER PROCEDURE dbo.ExistingProcedure

Steps to Reproduce

Steps to reproduce

  1. Connect a SQL document to a database.
  2. Write or locate a reference to an existing stored procedure.
  3. Place the cursor on the procedure name.
  4. Press F12.
  5. Inspect the generated definition document.

Actual behavior

The generated document starts with CREATE PROCEDURE.

Expected behavior

The generated document should start with ALTER PROCEDURE, because the procedure already exists.

The same principle should apply to existing functions.

Affected Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

If you selected "Other", please describe the affected area

Go to Definition (F12) for existing stored procedures.

Environment Information

  • OS: Windows
  • MSSQL extension: 1.45.1
  • VS Code version: 1.138

Confirmation

  • I have searched existing issues and couldn't find a match
  • I want to work on this issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions