SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Normalisation Script

By Chris Morton,

find the line FROM acc..ntnt (input 1 - in this case a linked excel document from our client) and modify it to point to your linked database or table.

next modify the column names as in the line 'input 2'. the column names must be exact matches to the source column names. the column names you input here are going to be the columns that are normalised into their own tables. the normailised tables will also be populated with the data. the orginal table will have referencial integrety with the normalised tables.

run the script.


ideal for a situation like this

a programmer may be tasked to perform normalization on

department, employment type, bank, medical aid, title - this script makes it easy by pointing it to your data source then specifing which colums you want normalised. run it - effortless normalisation.


fname lname department phone employment type bank medical aid title
bob mugabe Dep fraud and corruption 0768587777 permanent standard bank momentum ms
jabby zuma Dep fraud and corruption 0835421354 permanent first national discovery mrs
julia malema Dep misinformation 0762323633 temporary absa discovery ms
shabby shake Dep of prison evation null part time standard null miss

Total article views: 23 | Views in the last 30 days: 1