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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-gchenna-msft
Community Support
Community Support

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.

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.

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

March 2024  FBC Gallery Image

Fabric Monthly Update - March 2024

Check out the March 2024 Fabric update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors