SQL Flow Field Guide

OBJECT_DEFINITION

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

catalog lookup

What changes

Input
catalog metadata (object, column, index, file, database properties)
Output or change
id, name or property value
Return type
nvarchar(max)

Syntax at a glance

OBJECT_DEFINITION ( object_id )

Work example

Read a visible stored module definition for review.

Use schema-qualified names and test missing and permission-hidden objects separately.

Check your work Null can mean encryption, missing visibility, or no stored definition.

Open Microsoft Learn for full syntax, permissions, and details for your version.