hey, try to use set insted of select for assignmnt and verify your var is declared in same scope; sql can be quirky sometimes, so double-check your naming too!
In my experience, ensuring that the variable declaration and its assignment reside in the same execution scope is key. I faced issues when a query returned multiple rows, which disrupted the assignment process. I found that validating the uniqueness of the record by refining the WHERE clause helped prevent such errors. It is also critical to double-check that the data type of the variable matches the data type of the column being assigned. Using SELECT for assignment worked well once I addressed these potential pitfalls.
hey, im wondering if your query might be retuning multiples rows? try verifying that only one result is returned. curious, have you tried testing the variable in a simple query to see if it persists correctly? any other troubleshooting tips you used?