SQL query help

Notsogood

Registered User.
Local time
Today, 00:26
Joined
Jan 21, 2004
Messages
86
I am totally new to SQL server.I have to write a SQL statement which can divide field1 and put the result set in another field.In plain English I want to say, In Field1 if there is a Comma, put the letters between 2 commas, in field 2, If there is another comma put it in field three.
Field one is an adress field and has values like 19 Stoney Gardens, Livingston, West Lothian
I want this address to be divided. I am new and am stuck now.
What is the best way to write a SQL query for this.
Many thanks
 
export it to excel - use text to columns, load it back in !

HTH
 
Good idea but how do I do that in Excel. Not very good with Excel either. Please can you give me teh steps involved. Many thanks
 
run your select statement in SQL Analyser to extract your addresses

Copy and Paste your rows into excel.

Go to Data - Text To Columns.

Follow the instructions. You move the vertical lines about to sperate cells. i.e
13|Rowbourne Lane|London.

Press Finish and it seperates all the cells for you.

Load back into your db with Enterprise manager.
 

Users who are viewing this thread

Back
Top Bottom