How do I copy just the Scalar Functions from one Database to another? I’m not worried about copying any tables or data. I tried performing an Export Task but that seemed to only let me move tables.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
These steps were done on SQL Server 2008 R2 in SSMS.
In short, I used
Task->Generate Scripts...instead ofScript Database as->Create To. The latter only returned a SQL script to create the Database (e.g. Create Database, Alter Database, and Filegroups) without creating any other objects in the Database (e.g. Tables, Views or Functions).Here are the exact steps with screenshots:
Right click on the database with the functions you want and go to

Generate ScriptsClick through the first screen of the Wizard

Choose User-Defined Functions

Finish the wizard.
Also, this answer, while it isn’t an exact corollary, prompted me to look for the Generate Scripts option.