Sql Server Bits and Bats

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

From A Query Window
Execute Query
Ctrl+T Output as Text
Ctrl+D Output as Grid
select @@version Version of sql server
select serverproperty(‘productversion’),
Version of sql server (Since 2000)
sp_help table Long info about a table (or other object)
sp_tables table Short info about a table
sp_helpindex table Indexes for a table
sp_who Current connections
kill spid Kill 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

From SQL Server Management Studio GUI
Limit Server memory Right Click (at top level)->Properties->Memory->Maximum Memory
Logons Right Click (at top level)->Activity Monitor
Simple Recovery Right Click (on database)->Options->Recovery->Simple
Backup Right Click (on database)->Tasks->Backup
Shrink Right Click (on database)->Tasks->Shrink
Rename database files Right 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 telnet telnet bsq101 1433
Ctrl + ]
Test connection with odbc On desktop make empty text file: test.udl
double click
fill in odbc credentials
click test connection
Force protocol in connection string server=tcp:hostname
server=tcp:hostname, portNumber
Switch off connection pooling in connection string pooling=false;