Code Snippets and Templates

How to Use Code Snippets and Templates

Combine contains many built-in SQL and T-SQL code templates (also known as snippets). These snippets are provided in order to simplify the code-writing process of common tasks and procedures, such as table creation, database backups, addition of users and roles, and other popular actions. Furthermore, Combine allows users to customize the code snippets interface: create new code snippets, add new snippets to the interface, add snippet folders, as well as share snippets with other users.

To use a code snippet, find the desired snippet in the Code Snippets window, and then double-click it to open the snippet in the SQL editor window. The highlighted (selected) text represents a variable in the snippet. To replace the value of the variable, type the desired value and then press Tab to jump to the next variable. Once you hit Tab, the value of all instances of the variable in the script will be automatically replaced with the newly entered value. To complete your work in the code snippet, hit the Enter key to abort the automated snippet edit mode and to be directed to the end of the snippet script. In addition, you may hit the Esc key at any time to stop editing the snippet code.

Code snippets can be customized to fit your needs: Code snippets are stored as xml files and have the extension .snippet. When Combine is installed, default application snippets are installed as well and can be found under the Snippets folder (under the main application installation folder). These snippets can be customized in many ways, as now explained:

  • Creating new code snippets - by following the xml format of existing code snippets, users can create new custom code snippets.
  • Adding individual snippets to the user interface - after composing new custom snippets, these snippets can be places in existing snippet folders and then loaded into the user interface.
  • Adding new snippet folders - users can create new snippets, place them in custom folders, and then load the entire folder with all the snippets and templates into the user interface. Once loaded, Combine will remember the new settings and the new snippets will be part of the application until they are manually removed.
  • Sharing snippets with other users - users can share snippets by placing them under a shared network drive and folder, and then adding that folder as a snippets folder.

© 2001-2018 JNetDirect, Inc. All Rights Reserved.