Competition: What’s your favorite Redgate tool? Enter now.

Can't Undo Creation of In-line Table Valued Functions

ZianChoyZianChoy Posts: 7 Bronze 1
edited August 1, 2017 12:34PM in SQL Prompt
After using SQL Prompt version 7.0.0.49 with Microsoft SQL Server Management Studio version 12.0.4422.0 on Windows version 6.3 to create an in-line function, I can't undo the action.

Steps to Reproduce:
1. Start Microsoft SQL Server Management Studio
2. Click on "New Query" in the toolbar
3. Type "SELECT 123"
4. Select the text from step 3.
5. Click on the little black arrow that appears on the left.
6. Double-click on "Create in-line table valued function"
7. Press CTRL+Z

Expected Result:
SELECT 123

Actual result:
CREATE FUNCTION [schema].[function_name]
    (@parameter_name AS INT)
RETURNS TABLE
--WITH ENCRYPTION|SCHEMABINDING, ...
AS
RETURN ( SELECT 123 )
GO

Comments

  • Hi ZianChoy,

    This only happens when you're filling out a user placeholder, so Prompt is waiting for you to fill out the [schema].[function_name] bit. If you'd rather not, press escape (to cancel the snippet) or enter to finish it. After this, undo will be available again.

    Alternatively, you can edit the snippet and replace the $function_name$ text with [schema].[function_name].

    Best regards,

    David
  • Thanks for the advice. It answered my question completely.
Sign In or Register to comment.