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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL

Author  Topic 

raphikdanish
Starting Member

2 Posts

Posted - 2011-02-07 : 08:05:46
Hi,
I have a table

TableName: Index
indID indDesc indNo
-------------------------
1 string1 999
2 string2 999
3 string3 998
4 string4 998

I want to display all the records where indNo=999, but the output should be like below:

indDesc indDesc indNo
---------------------------
string1 string2 99


I will be very much thankful to receive reply.
Thanks.
Danish

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2011-02-07 : 08:51:33
It's not going to happen in RDBMS land unless you can guarantee the number of columns. You can it out as a single string unsing AS XML voodoo but not as multiple columns.
Go to Top of Page

raphikdanish
Starting Member

2 Posts

Posted - 2011-02-07 : 09:04:50
quote:
Originally posted by LoztInSpace

It's not going to happen in RDBMS land unless you can guarantee the number of columns. You can it out as a single string unsing AS XML voodoo but not as multiple columns.



Very strange.
I hope someone could have found some solution.
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2011-02-07 : 09:08:43
No it's not strange - it's the way things work. You certainly can do it as a single string or if you know the number of columns, but if you are considering variable columns as a solution then you misunderstand the way relational databases work.
What are you trying to do?
Go to Top of Page
   

- Advertisement -