SQL Server - 1:n Comma seperated list

Asked By Robert Bravery
30-Jul-08 11:25 AM
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


--
Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za
Database
(1)
Newbies
(1)
D7328CE2F6F5
(1)
F61960c9bf83
(1)
Kindness
(1)
Gourmet
(1)
Warant
(1)
Valuse
(1)
  --CELKO-- replied...
31-Jul-08 11:58 PM
Where is the DDL?


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


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.
  Plamen Ratchev replied...
30-Jul-08 11:40 AM
A few solutions here:
http://www.projectdmx.com/tsql/rowconcatenate.aspx


Plamen Ratchev
http://www.SQLStudio.com
  Alex Kuznetsov replied...
31-Jul-08 11:58 PM
that I would have a single row, with my parent [sic] description, then a co=
lumn with the child [sic] string values comma separated. <<

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 replied...
30-Jul-08 02:34 PM
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


--
Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za
  Robert Bravery replied...
30-Jul-08 02:38 PM
THanks. At least someone has the kindness to point me to some reading that
was extremely helpfull.

Robert


--
Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za
  EricRussel replied...
31-Jul-08 12:33 PM
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.
Create New Account
help
Server Management Studio I open the Connect to Server box with these values: Server Type: "Database Engine"; Server name: "ICHIBAN \ SQLEXPRESS" which is the correct name for the computer and the No user action is required. 2008-12-27 11:28:20.90 spid7s Starting up database 'master'. 2008-12-27 11:28:21.09 spid7s Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required. 00000003 2008 was started by login "sa". 2008-12-27 11:28:21.24 spid7s Starting up database 'mssqlsystemresource'. 2008-12-27 11:28:21.28 spid7s The resource database build version is 10. 00.1600. This is an informational message only. No user action is required. 2008-12-27 11:28:21.57 spid15s Starting up database 'model'. 2008-12-27 11:28:21.57 spid7s Server name is 'ICHIBAN \ SQLEXPRESS'. This functionality will not be available. 2008-12-27 11:28:21.81 spid7s Starting up database 'msdb'. 2008-12-27 11:28:21.87 spid15s Clearing tempdb database. 2008-12-27 11:28:22.23 Server A self-generated certificate was successfully loaded
Database Engine Tuning Advisor SQL Server I am trying to use the Database Engine Tuning Advisor. I have the developer edition of SQL2005 and SQL2008 installed with several no issues with anything I have tried to do until I attempted to run the Database Engine Tuning Advisor. When I start the Database Engine Tuning Advisor for either version of SQL I get the same message when I click Connect using either the sa account or a Windows account with the proper credentials: Database Engine Tuning Advisor Failed to open a new connection. Additional information: Could not find stored with you on this issue. From your description, I understand that we failed to use Database Engine Tuning Advisor to connect to SQL server database. If I have misunderstood, please let me know. Based on the current situation, it seems you use a pre-June Community Technology Preview (CTP) version of Microsoft SQL Server 2005 Database Tuning Advisor (DTA) client to tune Microsoft SQL Server 2000 or pre-June CTP versions
a server crash, and tape backups failed as well. The backups on disk for one database was recovered, but only the mdf ldf of a second database were recovered. Sql Server 2005 attached the database, and I haven't seen any errors in the data in any table I've 281474978938880, alloc unit ID 281474978938880 (type In-row data) is beyond the range of this database. Msg 2579, Level 16, State 1, Line 1 Table error: Extent (1:143120) in object 281474978938880, alloc unit ID 281474978938880 (type In-row data) is beyond the range of this database. Msg 2579, Level 16, State 1, Line 1 Table error: Extent (1:147472) in object 281474978938880, alloc unit ID 281474978938880 (type In-row data) is beyond the range of this database. Msg 2579, Level 16, State 1, Line 1 Table error: Extent (1:147496) in object 281474978938880, alloc unit ID 281474978938880 (type In-row data) is beyond the range of this database. Msg 2579, Level 16, State 1, Line 1 Table error: Extent (1:147520) in object 281474978938880, alloc unit ID 281474978938880 (type In-row data) is beyond the range of this database. Msg 2579, Level 16, State 1, Line 1 Table error: Extent (1:147712) in object
as the archived one except there are no transactions in the transaction log. If a database must be restored, the transaction file in the live area or its mirror is exported is moved to the live area, and the SQL file is run against the restored database resulting in zero potential for data loss. The SQL file can even be edited prior used to would look as odd to me as SQL Server's do to you. Database backups give you the database as of around the time that the backup finishes. (Actually I think it is as start of the oldest open transaction in the log when the backup finishes.) If the database is in full or bulk-logged recovery mode then log backups taken after the database backup can be applied either completely or up to a point in time. There is seems reasonably clear (to me at least). As for synchronizing the cut-off between the database backup and log backup, there is no particular need to do that. As long as integrity is maintained, and all the log backups are available, you can start with any database backup and apply all the subsequent log backups up to the end or up to
Database needs to be in single user mode to be backed up by DBMain SQL Server about this though. Is my Symantec Backup Exec causing this problem? Nobody is using the database in the middle of the night, when the DB Maintenance Plan kicks in to back Starting maintenance plan 'DB Maintenance Plan99' on 11 / 14 / 2008 3:00:00 AM [1] Database ECSTORE: Check Data and Index Linkage. . . * * Execution Time: 0 hrs, 0 mins, 1 secs * * [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 5070: [Microsoft][ODBC SQL Server Driver][SQL Server]Database state cannot be changed while other users are using the database 'FRESQL' [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER DATABASE statement failed. [Microsoft][ODBC SQL Server Driver][SQL Server]sp_dboption command failed. [2] Database FRESQL: Check Data and Index Linkage. . . [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 7919: [Microsoft ODBC SQL Server Driver][SQL Server]Repair statement not processed. Database needs to be in single user mode. The following errors were found: [Microsoft][ODBC SQL