Tip: Find Out the Column Name Using the COL_NAME() Function

You can use the following snippet to quickly find out a column’s name.

COL_NAME accepts two parameters: TableID and the ordinal position.

SELECT COL_NAME(object_id('waybill'),2) AS col_name


Visit the DevX Tip Bank


Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: