OBJECT_DEFINITION is not a recognized function!

  • Alright,

    Im running SQL Server 2005 Dev Edition on my works laptop. Ive just been reading up on Simple-Talk and came across a function called OBJECT_DEFINITION that is supposed to be similar to the sp_helptext in SQL 2000.

    Anyways, i checked the syntax in BOL and no matter what i do it doesnt work!

    Ive even tried the example in BOL for OBJECT_DEFINITION:

    SELECT OBJECT_DEFINITION (OBJECT_ID(N'sys.sp_columns')) AS [Object Definition];

    All i get is the error "'OBJECT_DEFINITION' is not a recognized function name."

    Any ideas?

    Matt

  • I'm going to hazard a guess that it's a custom-built function.

    The data you're looking for can usually be found in sys.sql_modules, in the definition column.

    select definition

    from sys.sql_modules

    where object_id = 1

    Use whatever object_id you're actually looking for, of course.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply