SQL unit test of stored procedure using INSERT/SELECT INTO syntax not supported - sql-server-data-tools

I'm having trouble using some of the rarer/newer INSERT/SELECT INTO syntax.
They run just fine from a SQL script from VS2015 + SSDT, but not within a SQL unit-test.
In all cases I am populating a temp table and using SQL Server 2012.
This standard syntax works just fine in both a SQL unit test and as a SQL script:
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:
SELECT *
INTO #Actual
FROM OPENROWSET('sqlncli', 'server=xxx;Trusted_Connection=yes;','EXEC xxx'*)
or
INSERT INTO #Actual
EXEC dbo.Xxx
The error I get is:
System.Data.SqlClient.SqlException: Incorrect syntax near the word 'INTO'.
So it's as if SQL unit tests are running differently than SQL scripts in Visual Studio.
Your help is appreciated.

Related

sp_configure is not found in Azure SQL Database?

I need sp_configure for running R scripts in MS SQL. But whenever I am trying to run anything like 'EXECUTE sp_configure' or 'exec sp_execute_external_script', it says 'Could not find stored procedure 'sp_configure'.' and ''sp_execute_external_script' failed because it is not supported in the edition of this SQL Server instance 'A5DC0B2838AC'. See books online for more details on feature support in different SQL Server editions.'
I even tried to create system stored procedure sp_config but was getting error at this line of the procedure "EXEC %%ServerConfiguration( ConfigID = #confignum ).SetValue( Value = #configvalue )" and the error is Incorrect syntax near '%'
sp_configure options and RECONFIGURE are not available on Azure SQL Database as explained here. Some options are available using ALTER DATABASE SCOPED CONFIGURATION.
To run R scripts let me recommend you Azure Machine Learning or create a SQL Server VM on Azure.
You can now run R scripts on Azure SQL Database Machine Learning as documented here.

Does Flyway support executing multiple SQL scripts called from one SQL script?

I am trying to execute multiple scripts from one SQL file, running it in sequence. E.g. if I have V1.0__Test0.sql, and the contents are:
#V1.1__Test1.sql;
#V1.1__Test2.sql;
If I run the migrate option, I get an ORA-00900: invalid SQL statement error. Does Flyway support what I am trying to achieve?
No. This is documented in the limitations: http://flywaydb.org/documentation/database/oracle.html#limitations

robot framework database library pymssql module error on scalar variable

i have used the keyword Execute Sql Script the sql script can be executed, but the content contains parameter declaration which looks like something like this:
**declare #itemNo nvarchar (10),
#itemId int
[insert script]
set #itemId = SCOPE_IDENTITY()
[insert script with #itemId used as one of the parameter]**
then when i execute this in ride, it always says that i have to declare #itemid. tried this also with adodbapi and it is the same error.
when i run the script in ms sql server, it runs fine, no errors.
has anyone encountered this? Any workaround? thanks!

Oracle - ASP sql command not properly ended

I am very new to Oracle and asp. I am trying to run a small MySQL query. But getting the error
ORA-00933 SQL Command not properly Ended
My query is
SELECT * FROM NAME_TBL WHERE username = 'admin';
I googled and tried all the options. The query running perfectly when it executed in Oracle SQL Developer
Please help me
Thanks in advance

do I need to learn sqldeveloper-specific commands for PL/SQL queries?

There are statements like
SET server output ON
PRINT var_name
DEFINE var_name
VARIABLE var_name
etc. which are typed outside the PL/SQL block. These are SQL+ commands which also seem to work on SQlDeveloper, both of which are tools to execute PL/SQL scripts in. Is there any standard that these non-PL/SQL commands follow, i.e. since they are tool-specific, they can differ, say in, SqlDeveloper and SqlPlus. Whose statements should I learn ?
You should learn the commands supported by the tool you are using - SQL Plus commands for SQL Plus, etc. There is overlap between SQL Plus and SQL Developer because SQL Developer has been designed to be easy to use by people who have previously used SQL Plus. To see which SQL Plus commands SQL Developer supports, open its online help and navigate to:
SQL Developer Concepts and Usage
Using the SQL Worksheet
SQL*Plus Statements Supported and Not Supported in SQL Worksheet

Resources