About 326,000 results
Open links in new tab
  1. Variables (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 18, 2025 · When a variable is first declared, its value is set to NULL. To assign a value to a variable, use the SET statement. This is the preferred method of assigning a value to a variable.

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

    Jul 23, 2025 · Variable declaration in SQL Server is an essential requirement to handle and process data efficiently in SQL scripts, stored procedures, and functions. Variables can be declared by using …

  3. 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.

  4. SQL Variables: Basics and usage

    Nov 18, 2019 · In this article, we have explored the concept of SQL variables from different perspectives, and we also learned how to define a variable and how to assign a value (s) to it.

  5. SQL DECLARE Variable: Complete Guide | Examples in All 5 Databases

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

  6. T-SQL Variables - Declare and Set variable

    Variables are a fundamental aspect of SQL Server programming, enabling developers to write more efficient, dynamic, and readable SQL scripts. Understanding how to properly declare, initialize, and …

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

    Learn how to declare variables in SQL queries with easy-to-follow examples and best practices. This guide covers syntax for different SQL databases, helping you write efficient and dynamic SQL code.

  8. How to Declare and Assign Value to a Variable in SQL Server

    May 2, 2025 · Understanding how to declare and assign values to variables is essential for writing efficient and maintainable SQL scripts. In this guide, we will explore different ways to declare and …

  9. SQL Variable: What It Is and How To Use It - dbvis.com

    Nov 18, 2024 · SQL variables can significantly simplify your SQL logic by allowing you to store temporary data in named placeholders. In this article, you will find out what SQL variables are, why …

  10. SQL Server: Declare Variables - TechOnTheNet

    Learn how to declare variables in SQL Server (Transact-SQL) with syntax and examples. In SQL Server (Transact-SQL), a variable allows a programmer to store data temporarily during the execution of code.