Forum Discussion

Etc's avatar
Etc
Frequent Visitor
2 years ago
Solved

Current Stored Procedure

Hello,   I am currently trying to create a stored procedure that I previously had on a SQL DB and there are a lot of syntax differences that I have to adjust to the warehouse syntax in Fabric. One ...
  • AndyDDC's avatar
    AndyDDC
    2 years ago

    Something like this:

     


    CREATE OR ALTER PROC dbo.spTest
    AS
    BEGIN

        select
            s.name AS SchemaName,
            object_name(objectid) AS ProcName
        from sys.dm_exec_requests AS EC
        cross apply sys.dm_exec_sql_text(EC.sql_handle)
        inner join sys.procedures pr on pr.object_id = objectid
        inner join sys.schemas s on pr.schema_id = s.schema_id
        where session_id=@@spid

    END