Get the maximum value of a DATALENGTH from the fields in a record

0

What I am looking for is how to get the maximum value of the DATALENGTH function from the fields in each record of a table. For example:

|No|Nombre y apellidos|Edad|Direccion|MaxLenCamp|
|1 |Juan Perez Garcia | 23 |Calle San Martin Puntual |25|
|2 |Amancio Castellano| 25 |Avenida de la Caridad del ponto |32|

The last field would have the maximum DATALENGTH value of each field in the record. But I can not manage to do it because the names of the fields can vary since it is a temporary table.

So far I have managed to get the names of the fields in a table with the query: select COLUMN_NAME FROM tempdb.INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '## Temp35321456'

Any ideas?

    
asked by user105872 04.11.2018 в 00:55
source

0 answers