ProProfs.com SQL Server T-SQL Tips

While writing T-SQL, you will oftentimes need to use functions to perform various tasks, such as aggregate an average, generate a timestamp, convert a data type, etc. An easy way to view a library of the various system functions (and even user-defined functions) is to do the following:

Expand the Database Node, expand the database you are working on, select the Programmability folder, and then select the System Functions folder. You can now select between all types of functions, and if you hover over specific functions, a tooltip will appear that describes what the function does. Additionally, if you expand the function, you can view a list of parameters that the function accepts.


An easy way to learn the proper T-SQL syntax to perform various tasks is to use the Template Explorer. The Template Explorer allows you to use a pre-defined template that accepts parameters to perform just about any task. This is a very nice way to ease into writing/customizing T-SQL without having to start from scratch.

To access Template Explorer, choose View | Template Explorer.

As shown in the snapshot to the right, there are many templates that you can choose from.

To simply swap the default template values with your own values, choose

Query | Specify Values for Template Parameters…

While writing T-SQL commands, you will often find that you can’t remember the exact syntax/structure for a command. An easy way to find help on that command is to highlight the command (for example, CREATE LOGIN), and hit Shift + F1 on your keyboard. This will open up Books Online immediately, and voila! the syntax is given.