June 3, 2010 at 5:40 pm
Actually I have table called fuits which has column name fruits_type having records like
record1:apple banana & mango
record2:apple chickoo & peach
It has fruit id as identity column. I should split data for first record like row1-apple
row2-banana & mango and in similar ways for second record it sud like row1-apple
row2-chickoo & peach
Here delimiter is char(30)+char(10)
I tried to write split function as follow:
declare @string
declare @delimiter
select @string=fruits_type from fruits where fruit_id=1
set @delimiter=char(30)+char(10)
There are lot of records like this in that table. so final result sud be like
frui_id fruit_tpye
1 apple
2 banana & mango
3 apple
4 chickoo & peach
This record has to be fetched in temp table but duplicate records have to be eliminated. so final temp table sud be like
1 apple
2 banana & mango
3 chicko & peach
I think we can write function or within stored procedure,we can write cursor for row by row procesing.But I don't know to write cmplx qurey.Please it's urgent.Can anyone help me with the code.It's too urgent.
June 3, 2010 at 6:04 pm
Please check out the first link in my signature, and then try posting your data in that suggested format. Then, based on the sample data you provide, show what the expected results should be. I bet you will have a lot more people willing to help you out then.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 3, 2010 at 6:38 pm
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply