SQL Prompt - 5.3
Working with aliases - SQL Prompt
You can set SQL Prompt to automatically assign an alias to each table and view that is referenced in a SQL statement. You can also define custom aliases for tables and views.
To manage aliases:
- On the SQL Prompt menu, click Options.
- On the SQL Prompt Options dialog box, select the Inserted code > Aliases page.

Alias assignment
When the Assign aliases check box is selected, SQL Prompt assigns an alias to tables and views that are referenced in a SQL statement, provided that you have specified a list of columns or used * to select all columns.
For example, if you select all columns from the table Contact, SQL Prompt creates the alias c to represent the table name Contact.
![]()
If you do not want SQL Prompt to include the AS keyword when it assigns aliases, clear the Include AS in alias definition check box.
Where possible, SQL Prompt generates aliases using the first letter of the table or view name. SQL Prompt also takes into account:
- underscores
TBL_Contactis assigned the aliastc - hyphens
hyphenated-tablenameis assigned the aliasht - case
MixedCaseis assigned the aliasmc
The suggestion box displays the learned aliases at appropriate points in your query, for example when you are typing a WHERE clause or adding additional columns to your query.
SQL Prompt creates additional aliases whenever there is ambiguity, for example in self-joins:

Custom aliases
If the aliases that SQL Prompt automatically generates do not satisfy your naming conventions, you can specify user-defined aliases for table or view names.
To add a user-defined alias:
- Under Custom aliases, click New.
- In the Alias Define Custom Alias dialog box, type the name of the table or view in the Object name box and the alias in the Alias box.
- Click Save.
For example, to specify the user-defined alias Con for the Contact table, type the following in the Define Custom Alias dialog box:

SQL Prompt will then assign the alias as follows:
![]()
To delete a custom alias, select the alias that you want to delete, and click Delete.
Prefixes to ignore
You can specify that SQL Prompt should ignore a prefix when assigning an alias for a column, table, or view name.
To add a prefix to ignore when generating an alias:
- Under Prefixes to ignore, click New.
- In the Prefix to Ignore dialog box, type the name of the prefix.
- Click Save.
For example, if you specify TBL as a prefix to ignore and there is a table called TBL_Orders, SQL Prompt considers only Orders when assigning an alias for the table name:
![]()
Notes
- Prefixes are not case-sensitive. Specifying
tbl,TBL, orTblas the prefix will result in the SQL Prompt behavior shown above. - You do not need to include the underscore in the prefix name.
Was this article helpful?
SQL Prompt
- SSMS failed to load SQL Prompt add-in 80070002
- No SQL Prompt menu appears in Query Analyzer
- SQL Prompt is showing an old version of my stored procedure (version 3)
- Removing menu items after uninstalling SQL Prompt and SQL Refactor
- A newly-created table exists, but it is not visible in the candidate list (version 3)
- Configuring permissions for SQL Prompt
- Using Intellisense or auto complete with a VS Web project (version 3.5)
- Uninstalling the Visual Studio 2005 add-in
- Unable to cast object of type 'System.DBNull' to type 'System.String' (version 3)
- Suggestions to improve performance for pre-formatted SQL (version 3.9)
- Changing the location of the settings, cache files and snippets folders
- Saving SQL Prompt options (version 3)
- SQL 2008 installation fails with Express Tools rule (version 3.8)
- Add-in failing to load into SQL Server Management Studio on Vista
- Removing SQL Server Management Studio Integration after uninstallation
- Layout SQL Error
- Downgrading to SQL prompt 3.9 from 4.0
- Candidate suggestions being displayed slowly
- SQL Prompt is not showing all linked servers
- Log files
- Refreshing the cache
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Prompt
- Activating your products
- Activating your products
- Getting help offline
- Customizing SQL Prompt to write SQL code more efficiently
- SQL Prompt 3.xx - reducing memory usage to improve performance
- Using SQL Prompt 4: tips for SQL Prompt 3 users
- SQL Prompt release notes - version 4.xx
- Release notes - version 5.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Prompt