I have to prepare for a presentation about generator and mutator functions.
I also read about them in my book, A first course in Database System.
I need an example, I tried to find it from internet but I can't.
So, could any one give me an example how to declare, use that functions.
Thanks very much!
I have never heard the terms "generator and mutator functions" in relation with a database. I have heard of "generator and mutator methods" as alternative names for creators and setters in OO languages.
- any stored procedure that creates a record in a table can be called a creator or generator
- any stored procedure that updates a column in one (ore more) record(s) can be called a setter or mutator.
Yet these are not functions, but procedures.
You cannot use user-defined functions for these methods. As user-defined functions cannot be used to perform a set of actions that modify the global database state. So no INSERTs, UPDATEs or DELTEs are allowed within a UDF (unless you are applying them on locally defined temporary table(s)).
With kind regards . . . . . SQL Server 2000/2005/2012
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2. Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
In the book: A first course In Database System, chapter 10.5.3, I found "Generator and mutator functions"
I understand what are they, the mater is I don't know how to use.
And a day ago, My teacher told me that, MS SQL server doesn't support that features