have table with two columns with datatypes as number and
varchar and the values in
A column like 1,2,3 AND B column values like a,b,c.
now need to display data in a single column as 1,a,2,b,3,c.
Answer Posted / saravanan
Try this way!
create table stest(num int,name varchar(10),value numeric
(10,2));
insert into stest values(101,'SARAN',1000.58);
insert into stest values(102,'KALA',1200.18);
insert into stest values(103,'AYYA',3000.40);
insert into stest values(104,'RATNA',4000.57);
SELECT * FROM STEST;
declare @str varchar(2000);
set @str = null;
select @str=ISNULL(@str+',','')+ltrim(STR(num))+','+name
from stest
select @str;
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
How to disable a trigger name update_salary?
Can we create table inside stored procedure?
How many sql databases can you have on one server?
What is sqlite used for?
How do I remove sql developer from windows 10?
What is difference between procedure and trigger?
What are the advantages of pl sql?
how many groups of data types? : Sql dba
What are different types of indexes?
How do you exit in sql?
What are the types of optimization?
What is cold data?
Can we enter data in a table in design view?
What is rank function in sql?
What is case function?