Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / July 2008

Tip: Looking for answers? Try searching our database.

1:n Comma seperated list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Bravery - 30 Jul 2008 16:25 GMT
Hi all,

I have a normal 1:N relation. My child table is just a list of string
values. I would like to have this list as a single column, comma seperated
So that I woul have a single row, with my parent description, then a column
with the child string valuse comma seperated.

Hope I have explaned correcly,

THanks
Robert

Signature

Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za

--CELKO-- - 30 Jul 2008 16:40 GMT
>> I have a normal 1:N relation. <<

Where is the DDL?

>> My child table is just a list of string values. <<

Where is the sample data?  Also "child" and "parent" are terms from
network databases. In RDBMS we have referenced and referencing  tables
instead.

>> I would like to have this list as a single column, comma separated so that I would have a single row, with my parent [sic] description, then a column with the child [sic] string values comma separated. <<

This is called violation of First Normal Form (1NF) and Newbies try to
do it all the time because they don't understand that in a tiered
architecture, display formatting in done in the front end, never in
the database.  Please read a book on Relational databases so you do
not make this mistake again.

I am sure that someone will give you a kludge, so you can write bad
SQL.
Alex Kuznetsov - 30 Jul 2008 18:55 GMT
> >> I would like to have this list as a single column, comma separated so that I would have a single row, with my parent [sic] description, then a column with the child [sic] string values comma separated. <<
>
[quoted text clipped - 3 lines]
> the database.  Please read a book on Relational databases so you do
> not make this mistake again.

Nonsense. Normal Forms do not apply to result sets. Your own books are
full of SELECT statements which produce result sets not in normal
forms.
Robert Bravery - 30 Jul 2008 19:34 GMT
First, I don't really need to be grilled on terms here. Second I thought the
question was simple enough to not warant sample data and ddl, a point in the
right direction, so reading material would suffice. Third I know what 1NF
is. Let me tell you this, My db design is correct, this project is handles
by many developer, the client wants it this way, the SQL is writen at the
client end using Linq. Fourth Its not a mistake, its a request, next if you
have no help to offer, why don't you get off your high and mighty horse and
go and harras someone else.
O and BTW, if the kludge works, it works.

RObert

>>> I have a normal 1:N relation. <<
>
[quoted text clipped - 25 lines]
> avast! - copyright (c) 1988-2008 ALWIL Software.
> http://www.avast.com

Signature

Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za

Eric Russell - 31 Jul 2008 17:33 GMT
Some clients want you to assume the role of a gourmet SQL chef and will
gladly pay for it, while other clients expect nothing more than short order
kludges. At the end of the day, we all have to earn a living.

> >> I have a normal 1:N relation. <<
>
[quoted text clipped - 16 lines]
> I am sure that someone will give you a kludge, so you can write bad
> SQL.
Plamen Ratchev - 30 Jul 2008 16:40 GMT
A few solutions here:
http://www.projectdmx.com/tsql/rowconcatenate.aspx

Plamen Ratchev
http://www.SQLStudio.com
Robert Bravery - 30 Jul 2008 19:38 GMT
THanks. At least someone has the kindness to point me to some reading that
was extremely helpfull.

Robert

>A few solutions here:
> http://www.projectdmx.com/tsql/rowconcatenate.aspx
[quoted text clipped - 8 lines]
> avast! - copyright (c) 1988-2008 ALWIL Software.
> http://www.avast.com

Signature

Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.