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

DELETE replaced with INSERT by SQLPrompt

I have noticed that if you try to type a DELETE statement immediately before an existing INSERT statement in Query Analyser, SQL Prompt turns the DELETE FROM into INSERT INTO. e.g.

{start typing DELETE statement here}
INSERT INTO A (B,C) VALUES (1,2)

And yet if you leave a blank line between the new line you are typing and the existing INSERT statement, it works, e.g.

{start typing DELETE statement here}
{leave blank}
INSERT INTO A (B,C) VALUES (1,2)

Weird!?
lewis.veale
0

Comments

3 comments

  • Tilman
    Hi Lewis,

    Thanks for reporting this. I'm afraid I couldn't reproduce it, though. Could you give me some more information on what you are doing? When does the delete statement change. Have you changed any of the default options?

    Regards,

    Tilman
    Tilman
    0
  • lewis.veale
    Hi Tilman

    Thanks for the response. I don't think I have changed any of the defaults - but I might have!

    It must be due to the specific syntax I have in the rest of the stored procedure. It's over 400 lines long, so I won't post it here. I have tried to extract a snippet which will reproduce the behaviour but I am unable. In fact, it is now doing something different (but also naughty) i.e.

    IF NOT EXISTS (SELECT ...)
    BEGIN
    {type DELETE in here}
    INSERT INTO ...
    END

    After typing DELETE and pressing SPACE, the above becomes:

    IF NOT EXISTS (SELECT ...)
    BEGIN
    END

    INSERT INTO...
    END

    i.e. the DELETE disappears to be replaced with END.

    I could send you the whole stored proc if you like?

    Cheers
    Lewis
    lewis.veale
    0
  • Tilman
    Hey Lewis,

    that would be great! Just pm it to me.

    We will totally rewrite the parser and basically everything else. Hopefully, that will sort out your problem and a whole host of others.

    Regards,

    Tilman
    Tilman
    0

Add comment

Please sign in to leave a comment.