This morning I was trying to call a stored procedure and insert the results in a temp table using the following code --
I got the error as below:
Msg 556, Level 16, State 3, Line 36
INSERT EXEC failed because the stored procedure altered the schema of the target table.
When I just run the stored procedure without inserting into the temp table, the stored procedure runs fine and gives the results.
I tried to look at the order of the columns of the temp table I am inserting into, and also the temp table column configurations. Everything looked the same.
So I started investigating the code in the stored procedure. I found one clue that could be causing this. The temp table in the store procedure has the same name as the temp table I am inserting the results of the stored procedure
So I changed the temp table name to table2 and then the results of the stored procedure were inserted into the new temp table table2.
So the final code is as follows:
Wednesday, December 06, 2017
It has been quite a while since I have posted about the free databases and data visualisation classes for 9 to 14 year old kids. So here I...
Today I was trying Node.js to connect to SQL Server, the connection to the sql server failed with the below error. name: 'ConnectionE...
In this post I would like to share my experience of migrating our Reporting server from sql server We installed SQL SERVER 2017 on...
This morning I was trying to call a stored procedure and insert the results in a temp table using the following code -- create table #...