Solved

SQL - T-SQL Syntax Question

Posted on 2014-03-18
2
211 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 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
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
Comment Utility
Thank you!  I kept finding lots of articles but nothing that quite fit.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now