Intellisense for system stored procedures
I just needed to re attach a database from a single mdf file. Something I do every 6 months or so and every time I have to google the command and its syntax. Would be helpful so SQL Prompt recognised and helped with these and other inbuilt procedures and their parameters, for example:
spattachsinglefiledb
sp_helptext
spattachdb
In 6.4 we always provide intellisense for system stored procedures if the query is being run against master.
If you’re running against a normal db then we hide the system stored procedures by default as they clutter the suggestions list. There’s a couple ways to get around this, either by qualifying with “sys.” or using the “List system objects” option. A video on this can be found here https://www.youtube.com/watch?v=i8DOTmHkKo8
-
Nick Gilbert commented
That's why I do that from the GUI - it's one of the things the GUI is best at :)
-
Paul White commented
sp_helptext -> definition column of sys.sql_modules or sys.computed_columns.
sp_attach_db and sp_attach_single_file_db are deprecated in favour of the following syntax, which SQL Prompt already supports:
To attach a database
CREATE DATABASE database_name
ON <filespec> [ ,...n ]
FOR { { ATTACH [ WITH <attach_database_option> [ , ...n ] ] }
| ATTACH_REBUILD_LOG }
[;]<filespec> ::=
{
(
NAME = logical_file_name ,
FILENAME = { 'os_file_name' | 'filestream_path' }
[ , SIZE = size [ KB | MB | GB | TB ] ]
[ , MAXSIZE = { max_size [ KB | MB | GB | TB ] | UNLIMITED } ]
[ , FILEGROWTH = growth_increment [ KB | MB | GB | TB | % ] ]
)
}<filegroup> ::=
{
FILEGROUP filegroup_name [ CONTAINS FILESTREAM ] [ DEFAULT ]
<filespec> [ ,...n ]
}<attach_database_option> ::=
{
<service_broker_option>
| RESTRICTED_USER
| FILESTREAM ( DIRECTORY_NAME = { 'directory_name' | NULL } )
}<service_broker_option> ::=
{
ENABLE_BROKER
| NEW_BROKER
| ERROR_BROKER_CONVERSATIONS
}