Return ColumnNames from Select query in SQL Server? -


first written select query join retrieving required columns. after using top 0 got required columns. come this, which come this

i dont want records. need result of column names this,

enter image description here

sample code:

select top 0 *tablename*.* *tablename* (some joins , conditions) 

tablename => contains dynamic columns (after doing joins)

inspired on @tony hopkinson suggestion

select c.name sys.tables t   inner join sys.columns c     on c.object_id = t.object_id     t.name = @table 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -