split a table column and insert in to 1 table | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

split a table column and insert in to 1 table

Hi,
I have table like below rowid rst_type dspl_code
1 B abc wer ret art aty sdf kjh set set tyo pqr 2 c 123 345 567 789 8910 3 D 1se 2we 3rt 4ty 5ft 6io I want to split dspl_code and like to store in one more table like rst_type dspl_code1 dspl_code2 dspl_code3 dspl_code4 dspl_code5
B abc wer ret art aty B sdf kjh set set tyo B pqr null null null null C 123 345 567 789 8910 D 1se 2we 3rt 4ty 5ft D 6io null null null null Thanks & Regards
Mathivanan K
Great work may have to pass through these stages – ridicule, opposition, and then acceptance. Each man who thinks ahead of his time will probably be greatly misunderstood.- vivekananda
Why do you want to split them and store it in Multiple column? Madhivanan Failing to plan is Planning to fail
i want to show this o/p in sql server reporting. Thanks & Regards
Mathivanan K
Great work may have to pass through these stages – ridicule, opposition, and then acceptance. Each man who thinks ahead of his time will probably be greatly misunderstood.- vivekananda
In Reports use Split function if any Madhivanan Failing to plan is Planning to fail
No i have a procedure that should return a result set like above. Thanks & Regards
Mathivanan K
Great work may have to pass through these stages – ridicule, opposition, and then acceptance. Each man who thinks ahead of his time will probably be greatly misunderstood.- vivekananda
Try to simulate this logic Declare @t table(col1 int, col2 varchar(100))
insert into @t Select 1,’as rt tu’ union all Select 1,’45 98 45′ union all Select 1,’88 57t 87u’
select col1, left(col2,2) as split1,substring(col2,3,2) as split2,substring(col2,5,2) as split3 from @t
Madhivanan Failing to plan is Planning to fail
]]>