470,591 Members | 2,196 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

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;
Expand|Select|Wrap|Line Numbers
  1. 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;
Expand|Select|Wrap|Line Numbers
  1. SELECT * INTO #Actual FROM OPENROWSET('sqlncli', 'server=xxx;Trusted_Connection=yes;','EXEC xxx')
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO #Actual EXEC dbo.Xxx
The error is;
Expand|Select|Wrap|Line Numbers
  1. System.Data.SqlClient.SqlException: Incorrect syntax near the word 'INTO'.
Your help is appreciated.
Jul 23 '20 #1
0 2776

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by Andre | last post: by
8 posts views Thread by jking482 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.