560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls 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
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|
25 Aytoun Street