Using variable to specify 'size' when declaring a VARBINARY

后端 未结 1 1744
鱼传尺愫
鱼传尺愫 2021-01-19 17:41

In SQL Server (2008 R2), instead of doing this:

DECLARE @testVar VARBINARY(64);

I would like to do this:

DECLARE @varSize I         


        
相关标签:
1条回答
  • 2021-01-19 18:41

    For a variable, why don't you just use MAX?

    DECLARE @testVar VARBINARY(MAX);
    

    This isn't the 70s anymore. Your system can handle it. In fact if what you want to do were possible, I suspect you'd waste more resources doing that than you would just declaring the variable as MAX in the first place.

    0 讨论(0)
提交回复
热议问题