JOEL LIPMAN Systems / Automation / AI

Knowledge base / Since 1999

Transact-SQL Tutorials & Guides

Practical Transact-SQL tutorials, troubleshooting notes and implementation guides from real projects.

Advanced search

22 entries / Transact-SQL

Clear filters
DataTumble - Randomize Data Rows
Transact-SQL

DataTumble - Randomize Data Rows

This is a stored procedure I've nabbed from some consultants from my day job. It shuffles the records and matching data values: Before: ID Name DateOfBirth --------- ------------ ----------- 1 John Smith 1988-06-24 2 Fred Bloggs 1972-11-17 3 Another User 1964-02-18 After: ID Name DateOfBirth...

Read note 27,705 hits
Copy a table with structure and data into a temporary table
Transact-SQL

Copy a table with structure and data into a temporary table

This will copy a given table into a temporary table all the while maintaining the structure and data. Thinking inside of the box I think everyone suggests the following (or at least the idea of): SELECT * INTO #MyTempTable FROM @GivenTable If @GivenTable is a parameter then the above will simply return an error. Also...

Read note 35,748 hits
Drop If Object Exists
Transact-SQL

Drop If Object Exists

Some people have been suggesting you can use "CREATE OR REPLACE ... VIEW ... FUNCTION" but my SQL Server 2008 Management Studio doesn't like this and refuses to understand what I'm trying to do.

Read note 32,679 hits
DataJumble - Shuffling characters in a data value
Transact-SQL

DataJumble - Shuffling characters in a data value

This was called a Data-Scrambling Function but it depends on what you mean by "scrambling". This is a function which merely uses the same characters but switches their order randomly, so I've renamed it DataJumble as opposed to my article on Data-Scrambling. Why? We want to scramble sensitive data that we send to suppl...

Read note 44,036 hits
T-SQL Record Separator
Transact-SQL

T-SQL Record Separator

I have googled, binged and asked but to no avail. Some self-proclaimed IT experts in forums said "why would you want to do that?". Unhelpful Bellends. It's a bit like asking me "Why can't I turn on my computer" and me replying "why would you want to do that?". Anyway, I was looking for something like the record separat...

Read note 66,349 hits
T-SQL DateTimestamps
Transact-SQL

T-SQL DateTimestamps

My setup Windows XP SP3 MS SQL Server Management Studio 2008 SQL Server 2008 R2 Regional Setting: London BST (British Summer Time)

Read note 16,923 hits
SQL Calendar in Business Intelligence Development Studio
Transact-SQL

SQL Calendar in Business Intelligence Development Studio

So I find myself searching the web for a way of producing an outlook-style calendar within Business Intelligence Development Studio (BIDS). Weekdays along the top and then dates inside. Additionally we would like this linked to events in a database. I'm calling this project "Reinventing the Wheel" because the request w...

Read note 61,388 hits

Working principle

Our Purpose

This site exists as a practical knowledge base built from real-world experience across systems, platforms, and technologies since 1999. Much of the content documents solutions, edge cases, and working patterns that were learned through investigation where documentation was incomplete or absent, and is shared to reduce the same friction for others.

27 Years in IT
1021 CRM clients
810 Site articles
29.7m+ Reads / hits

Knowledge base

Search notes

Find matching words in article titles and content.