You cannot change the object type in a script.
When you begin a new script, your initial shortcut menu selection determines what type of script Visual Database Tools will create. While using the SQL Editor, you cannot modify the object type. For example, if you select New Inline Function and change the script to a trigger or view, this error message appears when you attempt to save the script.
To correct this error
Restore the current script to the original object type.
Close the current script and use another menu selection to create a different type of object.