I need to create a global temp table in my SQL Server while executing an Azure Data Factory pipeline. This table will be used in several activities.
I already tried several approaches including one using the Stored Procedure activity targeting the sys.sp_executesql
SP and the CREATE TABLE
statement as the parameter. With this approach the table is actually created, but it's automaticaly dropped a second later, I don't understand why.
This is the script used to create the temp table:
CREATE TABLE ##tempGL
(
GLAccount NVARCHAR(15),
GLSubAccount NVARCHAR(15)
)
So, how can I create a SQL Server temp table from an Azure Data Factory Pipeline activity that persists until I dropped it?
create table
script? – scsimonsp_executesql
then it'll be created within the context of the (dynamic?) SQL your running and as soon as that batch is completed, the temporary table will be dropped. You'll need to create the temporary table before you usesp_executesql
and then it will persist until the outer session closes instead. db<>fiddle to demonstrate. – Larnu