devxlogo

Print All Table Column Definitions in an Entire Database

Print All Table Column Definitions in an Entire Database

The following script can be used to print all column definitions for all the tables in your database.

SELECTsys.schemas.name + '.' + sys.objects.name AS TableName,sys.columns.name as ColumnName,CASEWHEN sys.types.name IN ('char','varchar') THEN sys.types.name+'('+CASE WHEN sys.columns.max_length

devx-admin

Share the Post: