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

    Jul 23, 2025 · Variables allow you to store and manipulate data temporarily within the scope of a batch or procedure. By using the DECLARE statement, you can create variables with specific data types, …

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

    Jan 28, 2026 · To assign a variable a value by using the SET statement, include the variable name and the value to assign to the variable. This method is the preferred way to assign a value to a variable.

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

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

    Dec 12, 2024 · That's exactly what the SQL DECLARE statement is all about—a powerful tool to define variables within your SQL code. In this article, you will learn what the DECLARE SQL statement is, …

  8. T-SQL Variables - Declare and Set variable

    Understanding how to declare, initialize, and manipulate variables is fundamental for anyone looking to master SQL Server programming. In SQL Server, variables are used to store and manipulate data …

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

    Oct 31, 2025 · Learning how to declare a variable in SQL is fundamental to writing dynamic and efficient SQL code. This guide explains, step-by-step, how to declare and use variables within various SQL …

  10. 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 using the `SET` or …