Skip to content

Instantly share code, notes, and snippets.

@mukarramjavid
Last active March 24, 2023 06:55
Show Gist options
  • Save mukarramjavid/3d5eb921dd159e0835f12d7ca10330b7 to your computer and use it in GitHub Desktop.
Save mukarramjavid/3d5eb921dd159e0835f12d7ca10330b7 to your computer and use it in GitHub Desktop.
From this query you can get comma separated column names in sql server
SELECT STRING_AGG(COLUMN_NAME,',') AS ColNames
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'[table_name]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment