Closed. This question needs details or clarity . It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post .
Closed 1 hour ago.
Improve this question
I want to select both column names and values in a SQL query.
Here is what I have tried but this query only selects column name:
SELECT name
FROM sys.columns
WHERE object_id = OBJECT_ID('Table')
1条答案
按热度按时间osh3o9ms1#
To get the values from the columns you need to execute a query that is the result from this:
How to execute this statement, in for example a stored procedure, can be found on stackoverflow, for example here: How can I create a dynamic Select statement