This project is read-only.

DB Functions

May 9, 2010 at 6:51 AM


Just wondering if you can add functions as well as stored procedures via the tool.  I noticed the section for stored procs but i could not see anything for functions. The reason i am asking is i have a bit of complicated sql i want to use in a calculated column and it would be much easier as a function but i would still like to take advantage of your database versioning etc and install for all my DB's.




May 9, 2010 at 2:12 PM

You are right, there is no way to represent a function in the model. However after you generate the installer project you can add your function SQL to one of the update scripts. All files in the "Upgrade Scripts" folder will be run after the tables and stored procedures are installed. The scripts in "Upgrade Scripts\Generated" are installed before this point. Please add your custom script into this framework somewhere. When you run the installer project to create or upgrade your database, your custom stuff will be there too. This is all part of Evolutionary Database Design.