Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8757765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:22:53+00:00 2026-06-13T14:22:53+00:00

I’m attempting to get a list and definition of user defined functions within 3

  • 0

I’m attempting to get a list and definition of user defined functions within 3 different databases to combine into a single database.

I have the select statement that lists the 3 user defined functions but when I run it the ROUTINE_BODY column shows 'EXTERNAL' but EXTERNAL_NAME and EXTERNAL_LANGUAGE is NULL (as well as ROUTINE_DEFINITION which it should be for an EXTERNAL routine).

SELECT * 
FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_TYPE = 'FUNCTION'  

This gives me back the database, routine name, everything I need except for the actual definition of the function. Can anyone help me with where SQL Server may be storing the SQL for the functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:22:54+00:00Added an answer on June 13, 2026 at 2:22 pm

    You need to use object_definition system function

    select specific_name, object_definition(object_id(specific_name))
    from INFORMATION_SCHEMA.ROUTINES 
    where routine_type = 'FUNCTION' 
    

    UPDATE: Ok, so it’s not what you want. I’ve just missed that you need definitions of CLR functions and not standard user defined functions.
    Actually, I have a pair of script that can help you. You can get parameters of CLR function with them and then combine a scripts you need

    select 
        O.[object_id] as System_Object_ID,
        A.Name as Assembly_Name,
        ASM.assembly_class as Assembly_Class,
        ASM.assembly_method as Assembly_Method,
        case
            when ASM.execute_as_principal_id is null then 'CALLER'
            else PR.name
        end as Execute_As_Name
    from sys.assembly_modules as ASM with (nolock)
        inner join sys.assemblies as A with (nolock) on A.[assembly_id] = ASM.[assembly_id]
        inner join sys.objects as O with (nolock) on O.[object_id] = ASM.[object_id]
        left outer join sys.schemas as S with (nolock) on S.[schema_id] = O.[schema_id]
        left outer join sys.database_principals as PR on PR.principal_id = ASM.execute_as_principal_id
    
    select 
        O.[object_id] as System_Object_ID,
        P.name as Parameter_Name,
        T.name as [Type_Name],
        P.precision as [Precision],
        P.scale as [Scale],
        P.max_length as [Max_Length],
        case
            when P.has_default_value = 1 then isnull(cast(P.default_value as nvarchar(max)), 'null')
            else null
        end as Default_Value,
        P.is_output as Is_Output
    from sys.assembly_modules as ASM with (nolock)
        inner join sys.parameters as P with (nolock) on P.[object_id] = ASM.[object_id]
        inner join sys.objects as O with (nolock) on O.[object_id] = ASM.[object_id]
        left outer join sys.schemas as S with (nolock) on S.[schema_id] = O.[schema_id]
        inner join sys.types as T with (nolock) on T.system_type_id = P.system_type_id and T.user_type_id = P.user_type_id      
    

    or, may be easier, you can just script that objects from SSMS 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
I am currently running into a problem where an element is coming back from
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.