About 1,020,000 results
Open links in new tab
  1. How to Declare a Variable in SQL Server? - GeeksforGeeks

    Jul 23, 2025 · Variables can be declared by using the DECLARE statement and then values set to them by SET or SELECT statements. The functioning or operation of temporary data, logic …

  2. SQL Declare Variable Code Examples - SQL Server Tips

    Oct 30, 2025 · Learn how to define and use variables in SQL Server code with these many different SQL Declare Variable code examples.

  3. SQL Variables: Basics and usage

    Nov 18, 2019 · This way is tedious and inconvenient. However, we have a more efficient way to declare multiple variables in one statement. We can use the DECLARE statement in the …

  4. DECLARE @local_variable (Transact-SQL) - SQL Server

    Nov 18, 2025 · Variables are declared in the body of a batch or procedure with the DECLARE statement and are assigned values by using either a SET or SELECT statement. Cursor …

  5. How to set variable from a SQL query? - Stack Overflow

    See this question for the difference between using SELECT and SET in TSQL. If this SELECT statement returns multiple values (bad to begin with): Sign up to request clarification or add …

  6. DECLARE Statement - SQL Notebook

    Unlike other popular SQL scripting languages, SQL Notebook's DECLARE statement does not require a data type to be specified. Variables follow the SQLite convention of allowing any data …

  7. SQL DECLARE Variable: Complete Guide with Examples for SQL

    4 days ago · Therefore, this guide will explain everything you need to know about SQL DECLARE Variable across major databases in SQL Server, MySQL, PostgreSQL, and Oracle.

  8. SQL Server: Declare Variables - TechOnTheNet

    Learn how to declare variables in SQL Server (Transact-SQL) with syntax and examples. What is a variable in SQL Server? In SQL Server (Transact-SQL), a variable allows a programmer to …

  9. How Do You Declare a Variable in an SQL Query?

    In Microsoft SQL Server (T-SQL), variables are declared using the `DECLARE` statement, followed by the variable name and data type. Initialization can be done immediately or later …

  10. SQL Declare variable string

    In SQL Server, you can declare and initialize a string variable using the DECLARE statement along with the VARCHAR or NVARCHAR data type. Here's an example of how to declare a …