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

    Jul 23, 2025 · We cannot declare a variable and directly assign it the result from a subquery in the DECLARE statement in SQL Server. However, we can set a variable with a subquery after it …

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

    Nov 18, 2025 · 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. …

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

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

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

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

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

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

    Jul 23, 2025 · 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 …