About 164,000 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. How do I declare and assign a variable on a single line in SQL

    How do I declare and assign a variable on a single line in SQL Asked 15 years, 4 months ago Modified 8 years, 4 months ago Viewed 184k times

  3. sql server - how to declare variable in TSQL and use in multiple ...

    Apr 12, 2018 · How can I declare a variable in T-SQL and use it in multiple statements? For example:

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

    Aug 1, 2012 · User-defined variables are session-specific. That is, a user variable defined by one client cannot be seen or used by other clients. They can be used in SELECT queries using …

  5. SQL Server - In clause with a declared variable - Stack Overflow

    Dec 11, 2014 · To make it even more dynamic and alowing user input, I suggest declaring a varchar variable for the input, and then using a WHILE to loop trough the data in the variable …

  6. SQL Server SELECT INTO @variable? - Stack Overflow

    Jan 8, 2015 · SQL Server throws a fit with the above statement, however i don't want to have to create separate variables and initialize each one of them via a separate SELECT statement …

  7. sql - Must declare the scalar variable - Stack Overflow

    Must declare the scalar variable "@year" That's because you are trying to run a bunch of code that includes BOTH the stored procedure execution AND the query below it (!).

  8. Define variable to use with IN operator (T-SQL) - Stack Overflow

    3) A possible third option is table variables. If you have SQl Server 2005 you can use a table variable. If your on Sql Server 2008 you can even pass whole table variables in as a …

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

    How can I declare a variable and reuse it in statements that follow such as in using it SQLDeveloper. Attempts Use a DECLARE section and insert the following SELECT statement …

  10. sql - Declare a variable in a PostgreSQL query - Stack Overflow

    How do I declare a variable for use in a PostgreSQL 8.3 query? In MS SQL Server I can do this: