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
546 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 ...
In SSMS, how to add multiple aliases to tables using the ALT key |
---|
It's only a small thing, but … this blog shows how you can click and drag with the ALT key held down, then type to apply a table alias to lots of tables simultaneously. |
Sometimes it's the little things ... I'm indebted to Tobi from my course this week for this tip. Suppose you have a query like this:
SELECT
-- columns from the films table
FilmName,
FilmOscarWins AS 'Oscars',
FilmRunTimeMinutes AS 'Length'
FROM
tblFilm AS f
You want to prefix each of your columns with the alias you've given your table, to get:
SELECT
-- columns from the films table
f.FilmName,
f.FilmOscarWins AS 'Oscars',
f.FilmRunTimeMinutes AS 'Length'
FROM
tblFilm AS f
Here's the clever way to do this! Hold down the ALT key, then click and drag down the column names:
Hold down the ALT key and click and drag to select a line to the left of the column names to which you want to add an alias.
Type the table alias and a full stop in - anything you type will be inserted at the start of every selected line:
Characters that you type are added to every selected line.
Trivial, but strangely satisfying!
Some other pages relevant to the above blog include:
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.