How to script an object

SQL Complete makes it easy to script objects in queries as CREATE or ALTER, depending on the object type.

Objects that can be scripted as ALTER:

  • Stored procedures
  • Functions
  • Triggers
  • Views

Objects that can be scripted as CREATE:

  • Tables
  • Schemas
  • Synonyms
  • Aggregates
  • Sequences
  • Types
  • Queues
  • XML Schema Collections

Script an object as ALTER

To script an object as ALTER, do the following:

1. In the query window, right-click the object you want to script and select Script Object as CREATE/ALTER. Alternatively, point the cursor to the object you want to script and press Ctrl+F12.

Scripting an object as ALTER

2. The object will be scripted as an ALTER statement in a new query window.

Scripting an object

Script an object as CREATE

To script an object as CREATE, do the following:

1. In the query window, right-click the object you want to script and select Script Object as CREATE/ALTER. Alternatively, point the cursor to the object you want to script and press Ctrl+F12.

Scripting an object as CREATE

2. The object will be scripted as a CREATE statement in a new query window.

Scripting an object

Script Object as CREATE/Alter is not available for highlighted objects (objects that don’t exist in a database, or objects that aren’t parsed). If you select the option for such objects, you will get the warning:

Warning