Groups | Blog | Home
all groups > sql server programming > august 2005 >

sql server programming : Creating a stored proc that references an optional column


andrewgrandison NO[at]SPAM hotmail.com
8/24/2005 9:54:42 PM
Is it possible to create a stored proc which references a non-existent
field without getting the "invalid column name" error?

The field will only exist in one or two production databases (not in
all) but we still want the stored proc to exist in all databases so
that users in the future may add the new field to their own database
(using a Dictionary builder form that exists in the application) and
then be able to run the report (via the stored procedure) that
references the field.

The stored proc checks that the field exists before proceeding.

Thanks
Razvan Socol
8/24/2005 11:33:20 PM
It is possible only if the table does not exist when the procedure is
created. However, this is not a good idea. It would be better to create
two different procedures.

Razvan
AddThis Social Bookmark Button