Tag Archives: T-SQL

Indexes, Dynamic Views, and you.

I was trying to re-invent the wheel this week by writing an index creation script / procedure using the dynamic views provided by Microsoft in my 2k5 database. After looking in BoL and other sources for what the columns really … Continue reading

Posted in SQL Server Performance | Tagged , | Leave a comment

SQL Server Bug – Synonyns

The below bug was driving me crazy a few weeks ago until I figured it out via the power of Google. In short, when your target is on the same server, don’t include the server name. USE [master] GO –Create … Continue reading

Posted in SQL Server Development | Tagged , | 1 Comment

INSERT INTO & Temp Table Creation

At my previous employer, my old boss and I would debate the merits of using “INSERT INTO” to create temp tables. He was against it in all cases, where I would use it when I was exploring a problem, or … Continue reading

Posted in SQL Server Development | Tagged , , , | 2 Comments

SQL_Variant – Real world research

I came across a table for custom data fields that went something like this… Columns: PrimaryKey int EmployeeKey int Datatype varchar(20) intData int varcharData varchar(250) boolData bit numericData float (I laughed as well) dataData datetime (Ugh.) I’m looking at archiving … Continue reading

Posted in SQL Server Development | Tagged , , | Leave a comment

Getting back on the horse…

It’s been three weeks since I spent much time thinking about this site, mostly due to the distractions of starting a new gig and learning a whole new system. I know I’m not the first to think or say… type… … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Shrink Database and “free” code

I had a problem at work today resulting from running some “free” code. When I finally found the culprit I knew that I had a topic to write about, and upon arrival home I came here to write a note … Continue reading

Posted in SQL Server Performance | Tagged , | Leave a comment

Wildcard Searching

Searching for data with a less-than-desirable amount of instruction, or a vague “it ends in smith” is never fun. However, there are of course a variety of tools that are available to the developers in the world of T-SQL. As … Continue reading

Posted in SQL Server Development | Tagged , | Leave a comment

Database Mail – HTML Formatting

I received a request that a user wanted to be notified when Unusual_Event_01 occurred. The information request was beyond the scope of a simple text e-mail, but didn’t require an excel file to be created and dropped. I came up … Continue reading

Posted in SQL Server Development | Tagged , , , | Leave a comment

Temporary Table Scripting

New version: here A new job on our servers started failing with an odd message. Essentially, the problems boiled down to an INSERT INTO causing more problems than it was worth. The temp table in question that was being created … Continue reading

Posted in SQL Server Development | Tagged , , , | Leave a comment