Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved 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: 1986 | Views in the last 30 days: 1
 
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones