VS2015+SSDT SQL Unit Tests 'INSERT INTO' syntax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SQLUnitTester
    New Member
    • Jul 2020
    • 1

    VS2015+SSDT SQL Unit Tests 'INSERT INTO' syntax

    I'm having trouble using some of the newer/odder INSERT/SELECT INTO syntax's
    They run just fine from a .SQL dialog from VS2015, but not within a SQL unit-test.
    In all cases I am populating a temp table and using MSSQL 2015.

    This standard syntax works just fine in both a SQL unit-test and as a SQL script in DevStudio;
    Code:
    INSERT INTO #Expect ([Name], [System_Type_Name]) VALUES ('Mail_Option', 'Varchar(20)'
    However, these will not work in a unit-test but if you copy-n-paste into a script they work fine;
    Code:
    SELECT * INTO #Actual FROM OPENROWSET('sqlncli', 'server=xxx;Trusted_Connection=yes;','EXEC xxx')
    or
    Code:
    INSERT INTO #Actual EXEC dbo.Xxx
    The error is;
    Code:
    System.Data.SqlClient.SqlException: Incorrect syntax near the word 'INTO'.
    Your help is appreciated.
    Last edited by gits; Jul 24 '20, 08:56 AM. Reason: added code tags
Working...