February 5, 2010 at 11:34 am
guys i need help creating a udf which takes a string and comma separates them, any help is welcome i want to use the udf in a report which will accept a multi valued parameter
February 5, 2010 at 11:40 am
Are you talking about a delimited string split? Like this:
1,2,3,4 to
1
2
3
4
February 5, 2010 at 11:42 am
nope but 1 2 3 4
into 1, 2, 3, 4
February 5, 2010 at 11:48 am
klineandking (2/5/2010)
nope but 1 2 3 4into 1, 2, 3, 4
so:
select replace('1 2 3 4',' ',',')
Is that what you are looking for?
February 5, 2010 at 11:50 am
much more like
1
2
3
4
into 1,2, 3, 4
February 5, 2010 at 11:51 am
i want it to take a tabular result and turn it into a string that is from
1
2
3
4
int 1, 2, 3, 4
February 5, 2010 at 11:55 am
Will this help get you started:
create table #testtab (
intval int
);
insert into #testtab
select 1 union all
select 2 union all
select 3 union all
select 4;
select
STUFF((select ',' + cast(intval as varchar) from #testtab for xml path('')),1,1,'')
February 5, 2010 at 11:58 am
ll give it a try and give you feedback thanks
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply