I need to return an array in the stored procedure that takes a comma separated string value from a table and divides that string based on the comma and stores them in an array. Example: My table has a Column Tab_Val with row value as “COL1,COL2,COL3,COL4”, I need to take this row in my stored procedure and return an array
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 15, State 2, Line 11 error. Is it
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
getting different results from the same query according to the value of a variable
suppose we have the following masterdata: and we have the order tables: what is requested is to have one single query that could return 2 different sets of data, according to the value of a given variable v_order_status: v_order_status = ‘del’ then only transport orders is retrieved: v_order_status =any other value or null then we retrieve the whole table. the
Capture logging for stored procedure in Postgresql
We are working on a reporting project where we are executing stored procedures to perform transformations on the source data and convert it into the desired format. The transformed data will be inserted into a different table. We would like to know what are the best practices that needs to be implemented in the stored procedures mainly for To get
Too many arguments passed to Stored Procedure storing image
I am trying to store a JPG image into a MSSQL Server 2014. The image path was being passed into a stored procedure and part of the process within the proc is to store the image into a VARBINARY(MAX) field (I cannot change schema). My first attempt was within the same proc like this: Even though the command that came
How to update status for part with nothing data when this part is missed?
I work with SQL Server 2012 and have an issue: I can’t update status with No data returned where no result returned from select statement cross apply function. Meaning where no data returned when join parts and company to function then update status to this part with nothing data for that part when data is missing. When I run a
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, because by definition, all column names
Monitor the activity of a table (number of select on a specific row)
I have a large dataset Table: id | info1 | info2 | … There are multiples process accessing the data heavily. Is there a built-in way in postgresql or an extension to know the number of time a row is accessed with SELECT ? I was thinking of making a stored procedure and manually manage it. Answer No, there is