Forum Discussion
Etc
2 years agoFrequent Visitor
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 ...
- 2 years ago
Something like this:
CREATE OR ALTER PROC dbo.spTestASBEGINselects.name AS SchemaName,object_name(objectid) AS ProcNamefrom sys.dm_exec_requests AS ECcross apply sys.dm_exec_sql_text(EC.sql_handle)inner join sys.procedures pr on pr.object_id = objectidinner join sys.schemas s on pr.schema_id = s.schema_idwhere session_id=@@spidEND
AndyDDC
2 years agoMost Valuable Professional
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
Etc
2 years agoFrequent Visitor
Thank you, Andy, this worked!
If anyone else is trying to do the same thing, the code snippet works, however it requires the user to have the Admin role.