Saturday, February 25, 2012

can i use a store procedure as default value for a column?

Is it possible to use a stored procedure to fill the default value of a column when i'm building the db?

i mean if i can use a stored procedure for the "colum property": "default value or bnding"

if yes how can i do it?

No, you won't be able to specify a stored procedure in your table definition as a default value for a column. Your best bet for this is to set up a trigger (either AFTER or INSTEAD OF) to enforce the default value.

|||

You can, however, use a scalar user-defined function as the default value. So if you can convert the sproc to a UDF or call it from one, you're good to go.

Don

No comments:

Post a Comment