Can DMO be user to script ALTER PROCEDURE?

  • Matt Whitfield (9/28/2009)


    RBarryYoung (9/28/2009)


    I didn't say anything like that, Matt. Please don't try to put words in my mouth, that's not right.

    'unprofessional drek' roughly equates to 'stupid example' in my book...

    I think that this is category error. Let's look at what you called the exact same thing that I was referring to:

    ...it's meant to be an example of the worst of the worst - the worst possible case that you can think of.

    Technically, this is *worse* than what I called it, because you yourself called it "the worst possible". I don't see how you can claim injury over my characterization of something that you yourself said was "the worst of the worst"? Seriously?!?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • RBarryYoung (9/28/2009)


    I don't see how you can claim injury over my characterization of something that you yourself said was "the worst of the worst"? Seriously?!?

    I'm not... What I'm trying to get across is the fact that this thread is about using DMO to generate an ALTER PROCEDURE, not about what coding standards might be applied before it's creation to make that job easier. So yes, stupid example, unprofessional drek, worst of the worst - all those apply - but for me, the test case should be exactly that. To comment on the test case and how a DBA should reject the test case I didn't really feel was in keeping with the interest of the thread... However, it's pretty clear to me now that we've mostly been talking at cross purposes these last few posts. 🙂

    Seeing as this thread is the top google result for 'DMO ALTER PROCEDURE' I thought it was worth investing some time into to make people aware of the potential pitfalls. My test case had most of them, I believe 😀

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

  • Matt Whitfield (9/28/2009)


    RBarryYoung (9/28/2009)


    Matt Whitfield (9/28/2009)


    RBarryYoung (9/28/2009)


    Matt Whitfield (9/27/2009)


    But don't come in and say 'your test case is a stupid example'...

    I didn't say anything like that, Matt. Please don't try to put words in my mouth, that's not right.

    'unprofessional drek' roughly equates to 'stupid example' in my book...

    I don't see how you can claim injury over my characterization of something that you yourself said was "the worst of the worst"? Seriously?!?

    I'm not. What I'm trying to get across is ... So yes, stupid example, unprofessional drek, worst of the worst - all those apply ...

    Whoa, before you change the subject yet again, Matt, I want to be clear on this. You do now admit that I never said "your test case is a stupid example", and also that my calling the SQL code that it produced "unprofessional drek" was no different than you calling it "the worst of the worst"?

    I want to be clear about this because the tone of your responses gives me the impression that you thought that I was commenting of the status of your own code or your test case, when I was in fact commenting on the SQL Code that it produced for testing, just as you were later on. That's why I quoted, not your code, but the SQL code it produced.

    What I'm trying to get across is the fact that this thread is about using DMO to generate an ALTER PROCEDURE, not about what coding standards might be applied before it's creation to make that job easier. So yes, stupid example, unprofessional drek, worst of the worst - all those apply - but for me, the test case should be exactly that. To comment on the test case and how a DBA should reject the test case I didn't really feel was in keeping with the interest of the thread... However, it's pretty clear to me now that we've mostly been talking at cross purposes these last few posts. 🙂

    There is a long standing tradition in these forums of not answering questions in isolation and not allowing the OP to put us into a black box: if the best answer

    to change code other than that shown to us, or even if the best solution is a change of process rather than a change of code, then that is what we say.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • RBarryYoung (9/28/2009)


    Whoa, before you change the subject yet again, Matt, I want to be clear on this. You do now admit that I never said "your test case is a stupid example", and also that my calling the SQL code that it produced "unprofessional drek" was no different than you calling it "the worst of the worst"?

    The only subject I have posted on in this thread is changing CREATE DDL to ALTER DDL in a robust manner. I don't believe I have wavered from that? And I didn't say that it was any different... Your solution was to get DBAs to reject code and my point was that while the test case was a stupid example / unprofessional drek / whatever - there are perfectly valid, standards compliant examples of code which would also require more complicated parsing than just a replace. But, again, I can see now that we've been talking at cross purposes, because you were just commenting on how that example should be handled, and I was talking about a generalised approach to handling the DDL change.

    RBarryYoung (9/28/2009)


    I want to be clear about this because the tone of your responses gives me the impression that you thought that I was commenting of the status of your own code or your test case, when I was in fact commenting on the SQL Code that it produced for testing, just as you were later on. That's why I quoted, not your code, but the SQL code it produced.

    I'm honestly not convinced that my tone has been much different to yours. If my tone has offended you, then I apologise, because that was not my intention.

    RBarryYoung (9/28/2009)


    There is a long standing tradition in these forums of not answering questions in isolation and not allowing the OP to put us into a black box: if the best answer to change code other than that shown to us, or even if the best solution is a change of process rather than a change of code, then that is what we say.

    But is it really a solution? On what grounds would a DBA reject the more mundane example where the phrase 'create proc' just happens to naturally appear in a comment before the DDL? And that has really been my point all along - yes you can take my test case and say 'DBAs should reject that' - but it doesn't solve the problem, in my view.

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

  • The following is a regex that handles the edge cases that were presented earlier, BUT if you use it with regex replace, you will lose that ugly comments between CREATE and PROC (if there were any).

    (?<!'.*)(?<!--.*)(?<!/\*.*)(CREATE\s+(((\/\*)[\d\D]*?\*\/)|(--.*?[^\r]+))*\s*PROC)

    Try it at: http://regexhero.net/tester/

    I have bolded the parts of the test that get selected...

    Please note that this does not handle a /* */ and a -- comment in between the CREATE and the PROC. There are limits to what I can make regex do. 🙂

    /* CREATE PROCEDURE -> ALTER PROCEDURE example */

    -- CREATE PROCEDURE

    CREATE /* CREATE PROCEDURE */ PROCEDURE [dbo].[CREATE PROC_test]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    CREATE

    /*

    CREATE PROCEDURE

    */

    PROCEDURE [dbo].[proc_test]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    CREATE

    -- ALTER

    PROCEDURE [dbo].[proc_test]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    CREATE

    PROC

    [dbo]

    .

    [Stupid]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    CREATE

    --ALTER

    PROC

    [dbo]

    .

    [Stupid]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    After Replace

    /* CREATE PROCEDURE -> ALTER PROCEDURE example */

    -- CREATE PROCEDURE

    ALTER PROCEDURE [dbo].[CREATE PROC_test]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    ALTER PROCEDURE [dbo].[proc_test]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    ALTER PROCEDURE [dbo].[proc_test]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    ALTER PROC

    [dbo]

    .

    [Stupid]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

    ALTER PROC

    [dbo]

    .

    [Stupid]

    AS

    PRINT 'CREATE PROCEDURE';

    GO

Viewing 5 posts - 31 through 34 (of 34 total)

You must be logged in to reply to this topic. Login to reply