Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Written by Andrew Gould
Now that you know the basics of writing queries in SQL Server Management Studio here are a couple of techniques that can help speed up the process.
When you're working with large tables and you want to include all of the columns in a query it can be annoying to have to type out all of the column names. To avoid this you can use the asterisk symbol to show all of the columns in a table:
Replace the normal column names with the asterisk symbol in the SELECT list.
This is a quick and simple way to include all of the table columns, but it does mean that you can't add aliases to the columns and you have no control over the order in which the columns appear.
There are other good reasons not to use the asterisk to select all of the columns from a table, one of which is the performance of your query.
Rather than using the asterisk to include all of the columns from a table you can choose to script a table as a query. To do this, right-click on the table and choose the option shown in the diagram below:
Right-click on the table and choose the sequence of options shown here.
You will end up with a new query window and a complete SELECT statement that includes all of the columns from the selected table:
You can now remove any columns you don't want, put the columns in a different order and add your own aliases.
You can learn more about this topic on the following Wise Owl courses:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.