Skip to content

Tag: stored-procedures

How to fix that procedure in sql

I created procedure which count not null rows in the column, but query throws errors: @tableName is not declared and invalid object name tempTable. I don’t know why code throws that errors, because all variables are declared. Also when I make that program in another way, that code throw Msg 1087, Level …

Create and Run Query in Postgresql Procedure

I want to create a postgresql procedure which creates a query and run it. I tried and research on forums. But i can not solve my problem. Procedure should get user input as a parameter and use it in query. My code like that : And this is the error : edit: form_field is a table. create statement : Answer

Stored procedure to unpivot

I have a table with these columns: Where fields from 01 to 50 are dates. I need to have a table like this: Where title code should be the column name from 01 to 50, data should be the value of that column in mytable I did this stored procedure by looking in older questions: but I’m getting a syntax

SQL GroupBy for Stored Procedure caused Error

I have a quick question that why my SQL Stored Procedure did not work properly. Can someone explain what is wrong with my Stored Procedure Query? Error: “Each GROUP BY expression must contain at least one column that is not an outer reference.” Answer It can never work the way you are trying it, b…