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 ...
What is SQLCMD mode, and how can you use it? Part two of a three-part series of blogs |
---|
You can use SQLCMD mode to parameterise the connection, database name, table name and select columns for a query - and much more besides, as this blog explains.
|
You can either turn the mode on for a single query, or for all new queries that you create.
Note that turning SQLCMD mode on has one big disadvantage: you lose SQL intellisense (you may be surprised how much you've been relying on this). Oh, and the debugger also no longer works, although personally I don't find this useful anyway.
So I've written the following query, but SQL Server Management Studio (SSMS) is having none of it:
None of the syntax is recognised, because I haven't turned on SQLCMD mode for this query.
I can remedy this as follows:
From the SSMS Query menu choose this option to turn on SQLCMD mode.
It's very hard to see from the icon next to it whether you've invoked this option or not. The easiest thing to do is to type in a valid command beginning with a : and see whether it appears shaded in grey:
Things are looking good.
To do this, go into SSMS options:
Choose this menu item from the Tools menu.
You can now tick this box:
Tick the box to do exactly what it says!
Parts of this blog |
---|
|
Some other pages relevant to the above blogs 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.