To find most recent value of date column in SQL Server for a list of tables

I have about 1500 tables in my database. I used Information Schema to list all tables and all columns in each of these tables.

I would like to find out the most recent value of the columns

Select Table_name, Column_name From DB.Information_Schema.Columns  

This returns this output:

Table_name| Column_name ----------+------------ A         | C1 A         | C2 A         | C3 

All 1500 tables were displayed.

I now want to get a third column which gives me the most recent value (i.e the most latest value) of every column

Table_name | Column_name| Column_Value -----------+------------+-------------- A          |  C1        |  V1  A          |  C2        |  V2 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.