-
Setting a Column to Itself in a Where Clause
Many developers don't realize how handy it can be to set a column to itself in a WHERE clause in SQL.
-
Export your Data In Sql Server Using A Stored Procedure
This is seriously one of the coolest stored procedures there is.
-
Find All Children of Parent in Stored Procedure
Given a Parent ID, what is the best way to return all child records, their child records, ad inifitum? I needed this to find all employees beneath a given manager no matter how deep.
-
How To Debug Stored Procedures
Post in
-
Sql Server Templates
I keep saying this, but I can't believe I have been programming in Sql Server for this many years, and never heard of templates. While in Query Analyzer, hit Ctrl-Shift-Ins.
-
Shrink Sql Server Database and Transaction Log
Shrinking the transaction log was so very easy once I figured it out. All you need to do: 1. Backup your database just in case. 2. Run the following. If your database is called “Vampires”, then Database name will be “Vampires” and most likely your log file will be “Vampires_Log”: USE <DATABASE NAME> BACKUP LOG <DATABASE […]
-
Sql Server Reindex Tables
During my attempt to shrink my database so that it would fit on my laptop (it was 20 gigs), I figured out that I needed to reindex all my tables. Usually the format of your data and log files will follow this pattern – just replace the {DATABASE_NAME} with the name of your database. DBCC […]
-
Inserting Nulls Into Sql Table
Countless times I have needed this information, and countless times I can't remember it and have to go searching the net for it. So here it is so Google can search it easily. It is a keyboard hot key to enter a null value in a Sql Enterprise Manager field. Tab to the column and […]
-
Using NOLOCK with SELECT statements
Holy cow! Where have I been living? You can use NOLOCK with SELECT statements to tell SQL to not lock the row/table/page/database.