I have a query where I am trying to do a LIKE search on each value of a declared variable, instead of doing a like search on the entire field value/string. Example: The record I am looking for is “John and Jane Smith”. The query above returns NO result. If the user searches just ‘John’ OR just ‘Smith’ there are
Tag: variables
How do I return values from multiple columns when the column names are based on a variable result [closed]
I have a table in SQL Server which lists dates for different stages in a journey in separate columns. I also have a column which shows the current stage of the journey. For each stage, there is a …
Evaluating a variable using the IN() Function
I’m trying to resolve a datastep variable in the in() function. I have a dataset that looks like the following: |Run|Sample Level|Samples Tested| | 1 | 1 | 1-5 | | 1 | 2 | …
Slow sql statement when using variables
I have the following SQL statement running against a MariaDB 10.1.26 with ~2.000 rows with instant results. When I use the following statement with variables for the datetime fields, the execution takes ~5.5 seconds. The more data rows I have, the longer it takes to execute the statement. Seems like the variables change the behaviour of the statement somehow. What’s
PL/SQL fill variable with if-condition value
i am trying to fill a variable in PL/SQL with an if-condition value like this: v_variable := if(4 > 3) THEN ‘A’ ELSE ‘B’ END; but this doesnt work. Are there any options to do this? Answer Instead of doing this with an if, I’d go with case: