How does sql server query data field descriptions?

The comments of SQL Server are extended properties, which can be viewed from the sys.extended_properties view.

Select * from sys. extended _ properties where major_id=OBJECT_ID('WMSBASCUS').

The result is the annotation information of all columns in the WMSBASCUS table.

Minor_id is the id of the column. You can view the column id of the table from sys.columns.

You can view information about a specific column by associating sys.extended_properties with sys.columns

Select c.name, p.value

From sys.extended_properties p, sys.columns c

Where p. major _ id = object _ id ('WMS Bascus') and c.name='CUSTNO'.

p.major_id=c.object_id,p.minor_id=c.column_id