Struggling for Competence

Sql Server Bits and Bats

More of that pesky SQL Server stuff that I can never quite remember (checked with SQL Server 2008):

Common command in a query window
F5
Ctrl+E
Alt+X
Execute Query
Ctrl+TOutput as Text
Ctrl+DOutput as Grid
select @@versionVersion of sql server
select serverproperty('productversion'),
serverproperty('productlevel'),
serverproperty('edition')
Version of sql server (Since 2000)
sp_help tableLong info about a table (or other object)
sp_tables tableShort info about a table
sp_helpindex tableIndexes for a table
sp_whoCurrent connections
kill spidKill a connection
sp_rename 'dbo.oldtable', 'newtable'Rename a table (or anything in sys.objects)
sp_rename 'dbo.table.oldcolumn', 'newcolumn', 'COLUMN'Rename a column
Command action in SQL Server Management Studio
Limit Server memoryRight Click (at top level)->Properties->Memory->Maximum Memory
LogonsRight Click (at top level)->Activity Monitor
Simple RecoveryRight Click (on database)->Options->Recovery->Simple
BackupRight Click (on database)->Tasks->Backup
ShrinkRight Click (on database)->Tasks->Shrink
Rename database filesRight Click (on database)->Tasks->Detach
Rename on file system
Right Click (at top level)->Tasks->Attach (will have to adjust filenames)
Connection String
Test connection with telnettelnet bsq101 1433
Ctrl + ]
quit
Test connection with odbcOn desktop make empty text file: test.udl
double click
fill in odbc credentials
click test connection
Force protocol in connection stringserver=tcp:hostname
server=tcp:hostname, portNumber
server=np:hostname
server=np:\\hostname\pipe\pipeName
Switch off connection pooling in connection stringpooling=false;