Skip to main content
3 of 4
added 253 characters in body
freefaller
  • 217
  • 2
  • 4
  • 10

Create/Alter stored procedure without compiling

Is it possible to create or alter a stored procedure in SQL 2005* that doesn't compile the procedure?

(* - yes, unfortunately, we still need to support 2005 as our minimum standard)

I have a situation where it would be exceedingly useful to be able to create/alter a stored procedure that is syntactically valid but not semantically valid (due to incorrect table/column names)... which I can then alter accordingly within SSMS.


I've just had a thought, and it's a pretty simple solution... comment out the entire contents of the sproc when it's being altered/created.

Using Ctrl+K Ctrl+C will comment out each line individually - which would be better than using /* */ around the entire thing, as that will fail if there are any instances of /* */ in the sproc already.

I would still be very interested to hear if there is an actual way to tell SSMS to ignore invalid table/view/column names.


Thanks to @marcelo for his answer, and it does appear that using the name of a non-existent table will allow you to create the sproc.

However, it does not allow you to create a sproc if you use a non-existent column in an existing table

freefaller
  • 217
  • 2
  • 4
  • 10