x
login about faq Site discussion (meta-askssc)

sql query problem

Possible Duplicate:
function or SP or cursor question

I have table as follow.

Table Name:Industrial
ID Industry
1 Metal minings & Chemicals
2 Ceramics minings & pottery
3 Pottery minings & ceramics
4 Chemicals petrol & ceramics
5 Chemicals minings & ceramics
6 Ceramics pottery & petrol

Output should be
Temp Table
ID Industry
1 Metals
2 Minings & chemicals
3 Ceramics
4 minings & pottery
5 Pottery
6 Minings & Ceramics
7 Chemicals
8 Petrol & Ceramics
9 Chemicals
10 Mining & Ceramics
11 Ceramics
12 Pottery &petrol

As you can see in Temp table there are duplicate records,it should be eliminated Actual output should be
Temp Table
ID Industry
1 Metals
2 Minings & chemicals
3 Ceramics
4 minings & pottery
5 Pottery
6 Minings & Ceramics
7 Chemicals
8 Petrol & Ceramics
9 Pottery &petrol

Delimiter used for this break down of Industry column is char(30)+char(20) I think we can declare varaible delimiter and set it to char(30)+char(10). Please help me to write complete function for this output.

more ▼

asked Jun 04 '10 at 07:12 AM in Default

anamika gravatar image

anamika
2 2 2

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1843
x14

asked: Jun 04 '10 at 07:12 AM

Seen: 343 times

Last Updated: Jun 04 '10 at 10:27 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.