About 50 results
Open links in new tab
  1. How to set variable from a SQL query? - Stack Overflow

    I'm trying to set a variable from a SQL query: declare @ModelID uniqueidentifer Select @ModelID = select modelid from models where areaid = 'South Coast' Obviously I'm not doing this right …

  2. sql - How to declare a variable in MySQL? - Stack Overflow

    Aug 1, 2012 · 984 There are mainly three types of variables in MySQL: User-defined variables (prefixed with @): You can access any user-defined variable without declaring it or initializing …

  3. sql - Set vs let vs declaring variables in snowflake - Stack Overflow

    May 18, 2023 · DECLARE indicates a block of code used to define variables at the start of your SP, before you want to use them. LET is used define a single variable at the point where you …

  4. How can I use variables in an SQL statement in Python?

    After that, you can create two variables, one for the SQL and one for the parameters: sql = 'INSERT INTO table VALUES ?,?,?' data = (var1, var2, var3) cursor.execute(sql, data) Here, I …

  5. How bind variables in SQL statements improve performance of the …

    Oct 13, 2023 · The DBA asked me to replace the const and variable values with the bind parameters in a complex SQL statement to improve the performance of the query. However, I …

  6. sql - Query with variables - Stack Overflow

    Apr 18, 2012 · Is it possible to set/read variables from within the query? pseudo code: SELECT animal_name, @tallest_animal = (select top 1 height from animal order by height desc) as …

  7. Assign a variable a dynamic value in SQL in Databricks / Spark

    Dec 11, 2019 · I feel like I must be missing something obvious here, but I can't seem to dynamically set a variable value in Spark SQL. Let's say I have two tables, tableSrc and …

  8. Using bind variables with dynamic SELECT INTO clause in PL/SQL

    I have a question regarding where bind variables can be used in a dynamic SQL statement in PL/SQL. For example, I know that this is valid: CREATE OR REPLACE FUNCTION …

  9. sql - How do you use script variables in psql? - Stack Overflow

    In MS SQL Server, I create my scripts to use customizable variables: DECLARE @somevariable int SELECT @somevariable = -1 INSERT INTO foo VALUES ( @somevariable ) I'll then …

  10. How to declare variable and use it in the same Oracle SQL script ...

    The question is about to use a variable in a script means to me it will be used in SQL*Plus. The problem is you missed the quotes and Oracle can not parse the value to number.