Column Name & Value pairs

  • I would like to use a loop to process records from a cursor. Is it possible to get both column name and the column value from a single select statement? I've had a quick squint at Books Online but didnt find anything.

    It may be a dum query but I'm fairly new to T-SQL!

    Ta....... Chris

  • You could easily output the column_name and the value with something like this:

    use pubs

    select 'title_id',title_id,'title',title from titles

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply