First of all, thank you guys. You always know how to direct me, when I can not find the word to explain what I am trying to do to that cat.
Some of my tables need to have the default value of the columns. In other tables, the equivalent of the results of some complex calculations on other columns is the first thought that the column is the default value of the result of a stored procedure. I draw one or more criteria from the column in the calling table.
How do I do this, and any time the word "stored" and "process" in the next ground in each other in Google has flooded me with information about parameters default values and I actually Nothing related to what I want in
Half of that was more than the question ... Any thoughts though? And plz plz does not say "Well, you can use an on-disposal trigger ..."
You have to convert that stored procedure to a user-defined function. There are different types of UDF - the scalar UDF you will be seeing - will return a single value. For example, you can create a function like this:
To start as(@ 9) SET @ result = @ input2 + '- give:' + CAST (@Input1 AS VARCHAR (5)) Return @ Result and
Of course, you will be much more complex: -)
Once you do this, you can use this VARCHAR ( 100) can define to be the default for type column - either directly when a ALTER TABLE
statement:
create your table (.... ... some columns VARCHAR (100) Contract DF_Irrite Force_com column default (dbo.YourDefaultFunction (417, 'test'), .....)
or:
Alternate table debob. Your table ADD CONSTRAINT DF_YourTable_SomeCOLUM DEFAU LT for some columns (dbo.YourDefaultFunction (4711, 'Test2'))
Unfortunately, you define your function as a default value for columns Can not pass other columns as parameters of
Does that help ??
Comments
Post a Comment