Hi,
I'm having trouble with a stored procedure. I wanted to add another column in the final result of the stored procedure, but I think I broke something. The stored procedure that I am working with has a query to pull data from multiple tables; and combines it into a temp table. This combined data is then fed into an existing table using the "INSERT INTO" clause at the end of the query, to insert the data into an existing table. I should also probably mention that before the "INSERT INTO" clause there is a "TRUNCATE TABLE" clause used to truncate the existing data in that table
I wanted to add another column in the final result of the stored procedure, so I made the necessary additions wherever necessary in the SELECT clause(s). But then when I executed the stored procedure, and opened up the existing table to see if the changes were made, I got nothing. Now that table isn't showing any records; it just shows the column names that were previously coded into the query.
Fyi, the query runs fine if I run it outside of the stored procedure; I tested it and I was able to get the result stored in a new table, and it worked fine. I had all the data, including the new column, show up just fine. Has anyone experienced something like this? Any help is appreciated.
my problem started when I tried to add another column into the result of the stored procedure. I even tried to explicitly list out each column name, including the new column name in the insert into clause, but I still get nothing. The truncate command in the stored procedure has deleted all the rows in the existing table, and I can't get the new records to populate. Please see the below screenshot. I've highlighted the new column name.
This is what the existing table from the insert into clause looks like now:
Thanks,
Sajeel