How can we help you today? How can we help you today?

[RESOLVED] Possible Bug in Auto Insert Snippet

Hi,

I think I may have found a bug in SQL Prompt 2 in Auto Insert Snippet section.

I do a lot of stored procedures, views & functions so I have a snippet stored under a name of "nproc", "nview" & "nfunc".

The code for the "nproc" is below.
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[PROC_NAME_GOES_HERE]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[PROC_NAME_GOES_HERE]
GO
--
CREATE PROCEDURE [dbo].[PROC_NAME_GOES_HERE]
AS
BEGIN
END
GO

When I type in SQL 2000 Query Analyzer or SQL 2005 Management Studio I get the code below. Notice how the braces are gone..!
IF EXISTS SELECT * FROM dbo.sysobjects WHERE id = object_idN'[dbo].[PROC_NAME_GOES_HERE]' AND OBJECTPROPERTYid, N'IsProcedure' = 1
	DROP PROCEDURE [dbo].[PROC_NAME_GOES_HERE]
GO
--
CREATE PROCEDURE [dbo].[PROC_NAME_GOES_HERE]
AS
BEGIN
END
GO

Other nasty thing is when I try to test the snippet within the SQL Promopt window after editing it or adding it, this particular ("nproc", "nview" & "nfunc") just hangs the computer to it knees (hard reboot is required if I don't open task manager quickly and kill SQL Promot EXE). Basically when testing the snippet it just goes in an endless loop (I think).

Has anyone experienced this before? Please let me know if I am doing something wrong here.

Cheers :)
wrack
0

Comments

3 comments

  • Bart Read
    Hi Nick,


    I think (although I'm not 100% sure) that you may need to escape the parentheses by placing them in curly braces as follows: {(} and {)}. I think this will mean that they'll then appear, minus the curly braces, in the inserted text.

    Hope that helps.


    Thanks,
    Bart
    Bart Read
    0
  • wrack
    Hi Bart,

    Thank you for a quick and prompt reply. My apologies for calling it a bug and jumping the guns. My bad :oops:

    Cheers :)
    wrack
    0
  • Bart Read
    No problem, glad that sorted it out.
    Cheers,
    Bart
    Bart Read
    0

Add comment

Please sign in to leave a comment.