I have an application where the user can retrieve a list. The user is allowed to add certain filters. For example: Articles: 123, 456, 789 CustomerGroups: 1, 2, 3, 4, 5 Customers: null ArticleGroups: null … When a filter is empty (or null), the query must ignore that filter. What is the most performant way to build your query so
Tag: stored-procedures
How to update columns only if argument is equal to specific value?
I have query that should update columns only if argument is equal 1. Here is example: I would like to move this SQL query to stored procedure. How I can achive the same process with SQL code only? Instead of <cfif form.status eq 1> title = @title,</cfif> how that can be replaced with SQL code? I use Sybase database and
How to create SSRS report that use different aggregation algorithms on the same column? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I’d like to create a report that has columns like Year, Month, Earnings. From Month Jan. to Sept, the report
How to print the cursor values in oracle?
I am new to oracle and I am learning cursors.My table City has two columns city_id,city_name.So,this is what I tried: i am trying to assign the data of cursor to the newly declared value v_list SYS_REFCURSOR;.But the output is coming as error at v_list := city_list;.How can I assign all the values of cursors to the another cursor directly or
Invalid object name of stored procedure error
I have a stored procedure such as below : when I execute this procedure, I get an error: Invalid object name ‘dbo.sp_InsertPumpsStatus’ What is problem? Answer In your script, It can be clearly seen that, You are giving same name to the stored procedure as the table in statement. Make sure the defined table on Insert statement is correct. If
Insert stored procedure results into temp table
I have a stored procedure that returns this result: The way I call the stored procedure is: I want to store these results into a temp table so I used insert into like this: But I get an error like this: INSERT EXEC failed because the stored procedure altered the schema of the target table. Answer Hard to say without
I’m going to get the ten day sales report and i want to return 0 if there is not record for each day
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Sp_Rsv_DailyContractReport] @ContractDate datetime =null, @RegisterUsersId varchar(32) = null AS Select …
Stored Procedure Data Type Conversion Error
I try to execute the following SP it gives me this following error. Msg 8114, Level 16, State 5, Procedure TEST, Line 55 [Batch Start Line 12] Error converting data type nvarchar to …
How to insert data into a String array in postgres stored procedure
I have a pseudo stored procedure as given below: CREATE OR REPLACE FUNCTION get_data() RETURNS void AS $$ DECLARE rec_new RECORD; querystring TEXT[]; cursor_file CURSOR FOR …
Create a stored procedure which includes return records
I am trying to create a stored procedure which has 3 parameters. Another software will call my procedure with parameters in order to query a bunch of records. The stored procedure includes only a …