Is there a way to make a TSQL variable constant?

前端 未结 12 1044
别那么骄傲
别那么骄傲 2021-02-01 11:31

Is there a way to make a TSQL variable constant?

12条回答
  •  别那么骄傲
    2021-02-01 12:12

    Okay, lets see

    Constants are immutable values which are known at compile time and do not change for the life of the program

    that means you can never have a constant in SQL Server

    declare @myvalue as int
    set @myvalue = 5
    set @myvalue = 10--oops we just changed it
    

    the value just changed

提交回复
热议问题