Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Mutivalue in table by using TSQL/Store Procedure
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

4 Posts

Posted - 03/16/2001 :  01:11:49  Show Profile  Reply with Quote
Hi All
I got table as below
ID Name Type
-- ---- ----
1 A C
1 J C
2 F D
2 K H
3 L P

I wnat to make new table as below by using TSQL/store procedure in SQL7

New Table
ID Name Type
-- ---- ----
1 A;J C;C
2 F;K D;H
3 L P

Please help me out if u can
PS: please send me a sql file if u can
many thanks



United Kingdom
12543 Posts

Posted - 03/16/2001 :  11:29:12  Show Profile  Visit nr's Homepage  Reply with Quote
Would probably be better (and easier) to do this with temp table but without something like.

insert NewTbl
select ID, Name, Type
from Table1
where convert(varchar(10),id) + Name + Type
in (select min(convert(varchar(10),id) + Name + Type) from Table1 group by id)

while @@rowcount > 0
update NewTable
set Name = Name + ';' + Table1.Name,
Type = Type + Table1.Type
from Table1
where convert(varchar(10), + Table1.Name + Table1.Type in (select min(convert(varchar(10),id) + Name + Type) from Table1 where convert(varchar(10), + Table1.Name + Table1.Type > convert(varchar(10), + right(NewTable.Name,1) + right(NewTable.Type,1) group by id)
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000