Create SP with Invalid Syntax

  • I have an obsolete Stored procedure, and I would like to put some comments in it for future reference, but I can because of "Ambiguous Column Names" errors. I don't want to fix it since it's not being used, but I would like to modify it. Can it be done ? Hack into system tables somehow ?? (not so easy in 2005)

  • Can't you just comment everything in the body of the proc?

  • I could do that. But I wanted to leave the code as original as possible.

  • You should not leave the code just "as original as possible".

    Either fix it to be runable code again (returning the same results as original) or drop it. If needed, you could script out the proc for future use. I can see no valid reason to keep a non-working procedure in the system.

    To fix it:

    Normally, those errors show up if the columns referenced in SELECT or WHERE clauses are not qualified (e.g. Col1 instead of Table1.Col1) and two or more tables have columns with those (identical) names.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Why not to keep it as a seperate file on OS. If the SP is unusable, it should not be in the database.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • homebrew01 (4/22/2009)


    I have an obsolete Stored procedure, and I would like to put some comments in it for future reference, but I can because of "Ambiguous Column Names" errors. I don't want to fix it since it's not being used, but I would like to modify it. Can it be done ?

    No.

    Hack into system tables somehow ?? (not so easy in 2005)

    Only if you're willing to risk a corrupt and unusable database.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Since the code is unusable, I don't see the point of keeping it intact. Comment it out. That will leave it in place if you really must.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 7 posts - 1 through 6 (of 6 total)

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