Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
cubansalsa
Frequent Visitor

INSERT is not a supported statement type

I have a Stored Procedure from SQL Server that uses a CTE to insert rows into a Data warehouse table that I want to replicate in Microsoft Fabric.

I keep on getting errors that into statement is not supported.

DROP PROCEDURE IF EXISTS [dbo].[Daily_Load_Daily_Enrollment_v1]
GO
CREATE PROCEDURE [dbo].[Daily_Load_Daily_Enrollment_v1]
    -- Add the parameters for the stored procedure here

--DECLARE @load_date DATETIME = getdate()
AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.
        SET NOCOUNT ON;

        /**** This is for open enrollment dates ****/
        DECLARE @Date DATE
        SET @Date = CONVERT(DATE,GETDATE()-1)
       
        ;WITH FIND_TERM AS
        (
            SELECT DISTINCT A.EMPLID,
                            A.STRM,
                            A.ACAD_CAREER,
                            A.CLASS_NBR,
                            A.UNT_PRGRSS,
                            A.STDNT_ENRL_STATUS,
                            TR.TERM_BEGIN_DT,
                            TR.TERM_END_DT,
                            @Date AS 'Enrollment_Date'
            FROM (SELECT EMPLID, STRM, ACAD_CAREER, CLASS_NBR, UNT_PRGRSS, STDNT_ENRL_STATUS
                FROM Student_Data.dbo.cs_PS_STDNT_ENRL
                WHERE STRM >= '2217'
                    AND STDNT_ENRL_STATUS = 'E'
                    AND ACAD_CAREER <> 'CEPD'
                    AND GRADING_BASIS_ENRL <> 'NON'
                ) A
            LEFT JOIN Student_Data.dbo.cs_PS_TERM_TBL TR
            ON A.STRM = TR.STRM
                AND TR.ACAD_CAREER = 'UGRD'
            INNER JOIN Student_Data.dbo.cs_PS_SESSION_TBL S
                        ON TR.STRM = S.STRM
                        AND TR.TERM_BEGIN_DT = S.SESS_BEGIN_DT
                        AND TR.TERM_END_DT   = S.SESS_END_DT
            WHERE @Date BETWEEN S.FIRST_ENRL_DT AND S.SESS_END_DT
        )SELECT * FROM FIND_TERM
1 ACCEPTED SOLUTION

Now it works.  Did you do anything?  Thank you anyway.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hello @cubansalsa ,

Thanks for using Fabric Community.
At this time, we are reaching out to the internal team to get some help on this .
We will update you once we hear back from them.

Anonymous
Not applicable

Hi @cubansalsa ,

Can you please confirm above SQL is complete SQL query? As there is nothing in the SQL code that looks problematic and there is no INSERT statement.

It is correct.  Just replace the las select * with select * into.

or try to use any into stament and you will get the error.

thank you for looking into this problem.

Anonymous
Not applicable

Hi @cubansalsa ,

When I tried to repro your scenario, I didn't face any issue.
I was able to run the query in Data Warehouse without any issues.

vgchennamsft_0-1711532676589.png


Can you please share the screenshot of your issue? 

Now it works.  Did you do anything?  Thank you anyway.

Anonymous
Not applicable

Hi @cubansalsa ,

It might be an Intermittent issue, glad to know that your issue got resolved. Please continue using Fabric Community on your further queries.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors