Solved

SQL - T-SQL Syntax Question

Posted on 2014-03-18
2
219 Views
Last Modified: 2014-03-18
I have a small table with LocationID and Year fields which I would like to manipulate into a view that can be used in a sproc to bind this and additional data to an asp.net control.  For each LocationID I am trying to concatenate the associated years (ordered DESC) into a comma-separated string field which will in turn be bound to my tooltip.

I think this should be doable but I am totally stuck on syntax.  Any helpful experts want to give me a start?  Thanks.
0
Comment
Question by:AJ0718
2 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 39937913
See the stuff/ForXML path here:
http://sqlandme.com/2011/04/27/tsql-concatenate-rows-using-for-xml-path/

The article explains exactly what you're trying to do.
0
 

Author Closing Comment

by:AJ0718
ID: 39937960
Thank you!  I kept finding lots of articles but nothing that quite fit.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question