.Net Programming in Simple

Monday, 30 December 2013

Extract single row of a table separated by comma

DECLARE @XYList varchar(MAX)
SET @XYList = ''

SELECT @XYList = @XYList + CONVERT(varchar, X) + ',' + CONVERT(varchar, Y) + ','
FROM POINTS

-- Remove last comma
SELECT LEFT(@XYList, LEN(@XYList) - 1)
Posted by mohanty at 21:45
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: SqlServer

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2016 (1)
    • ►  September (1)
  • ►  2014 (15)
    • ►  August (3)
    • ►  July (2)
    • ►  June (2)
    • ►  May (1)
    • ►  February (1)
    • ►  January (6)
  • ▼  2013 (140)
    • ▼  December (14)
      • Extract single row of a table separated by comma
      • Concatenate multiple rows to single having similar...
      • Use Column alias in Where Condition
      • column name of a table separated by comma in sqlse...
      • Sql Various Testing (Procedure,Cursor)
      • Get the value of treenode which are checked in.net
      • Comma separated values in sqlserver
      • Progressbar in c#
      • Javascript function to show message before redirect
      • Get the database space used in sqlserver
      • Converting Columns into Rows in sqlserver
      • Sql Server Various Testings
      • Reset Identity Value while there is no records in ...
      • Reset Identity Value while there is no records in ...
    • ►  November (4)
    • ►  October (11)
    • ►  September (13)
    • ►  August (19)
    • ►  July (29)
    • ►  June (50)

About Me

mohanty
View my complete profile
Simple theme. Powered by Blogger.