About 243,000 results
Open links in new tab
  1. DECLARE @local_variable (Transact-SQL) - SQL Server

    Nov 22, 2024 · Transact-SQL reference for using DECLARE to define local variables for use in a batch or procedure.

  2. How to Declare a Variable in SQL Server? - GeeksforGeeks

    Aug 23, 2024 · By using the DECLARE statement, you can create variables with specific data types, which can then be assigned values using the SET or SELECT commands. In this …

  3. SQL Declare Variable Code Examples - SQL Server Tips

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

  4. SQL Variables: Basics and usage - SQL Shack

    Nov 18, 2019 · The DECLARE statement is used to declare a variable in SQL Server. In the second step, we have to specify the name of the variable. Local variable names have to start …

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

    My use case was that I wanted to set a variable to a string. All the other answers here show how to set a variable using the output of a SELECT statement. Here's how to do it with a simple …

  6. Variables (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 22, 2024 · Declare a Transact-SQL variable. The DECLARE statement initializes a Transact-SQL variable by: Assigning a name. The name must have a single @ as the first character. …

  7. A Guide To the SQL DECLARE Statement - dbvis.com

    Dec 12, 2024 · In SQL Server, the DECLARE statement allows you to declare variables in a transaction or the body of a batch or procedure. You can then assign values to these variables …

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

    Nov 22, 2016 · Local variables needs to be declared using DECLARE before accessing it. DECLARE start INT unsigned DEFAULT 1; . DECLARE finish INT unsigned DEFAULT 10; …

  9. How to Declare a Variable in SQL? - GeeksforGeeks

    Dec 30, 2024 · In this article, we will explain various methods and best practices for declaring variables in SQL, along with the syntax and examples, that help us write more dynamic and …

  10. The Table Variable in SQL Server - SQL Shack

    Dec 3, 2019 · The following syntax describes how to declare a table variable: If we want to declare a table variable, we have to start the DECLARE statement which is similar to local …

Refresh