Home All Groups Group Topic Archive Search About

The opposite to DECLARE..

Author
12 Sep 2006 11:44 AM
Man-wai Chang
DECLARE instantiates a variable. How could I release a variable?

--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
  ^ ^   19:44:01 up 3 days 38 min 0 users load average: 1.02 1.01 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

Author
12 Sep 2006 11:51 AM
Aaron Bertrand [SQL Server MVP]
Variables are released when the proc/batch goes out of scope.  There is no
need to "release" them...




Show quote
"Man-wai Chang" <toylet.toy***@gmail.com> wrote in message
news:eEIscDm1GHA.1292@TK2MSFTNGP03.phx.gbl...
>
> DECLARE instantiates a variable. How could I release a variable?
>
> --
>  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
> / v \  Simplicity is Beauty! May the Force and Farce be with you!
> /( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
>  ^ ^   19:44:01 up 3 days 38 min 0 users load average: 1.02 1.01 1.00
> news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
Author
12 Sep 2006 11:58 AM
Roji. P. Thomas
Well, except for Cursors. For Cursors you can use DEALLOCATE

--
Regards
Roji. P. Thomas
http://toponewithties.blogspot.com
Show quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:%23CMsrGm1GHA.4388@TK2MSFTNGP03.phx.gbl...
> Variables are released when the proc/batch goes out of scope.  There is no
> need to "release" them...
>
>
>
>
> "Man-wai Chang" <toylet.toy***@gmail.com> wrote in message
> news:eEIscDm1GHA.1292@TK2MSFTNGP03.phx.gbl...
>>
>> DECLARE instantiates a variable. How could I release a variable?
>>
>> --
>>  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
>> / v \  Simplicity is Beauty! May the Force and Farce be with you!
>> /( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
>>  ^ ^   19:44:01 up 3 days 38 min 0 users load average: 1.02 1.01 1.00
>> news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
>
>
Author
12 Sep 2006 12:48 PM
Man-wai Chang
Aaron Bertrand [SQL Server MVP] wrote:
> Variables are released when the proc/batch goes out of scope.  There is no
> need to "release" them...

I want something like Foxpro

local m.lcVar
.... processing..
release m.lcVar

I have my reason to release a variable early....

--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
  ^ ^   20:47:02 up 3 days 1:41 0 users load average: 1.00 1.00 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
Author
12 Sep 2006 1:11 PM
SQL Menace
you can't 'release' it but you can set it to NULL if that is what you
would like????

declare @i int
set @i = 5

do something here

set @i = NULL

But there really is no need to do this

Denis the SQL Menace
http://sqlservercode.blogspot.com/

Man-wai Chang wrote:
Show quote
> Aaron Bertrand [SQL Server MVP] wrote:
> > Variables are released when the proc/batch goes out of scope.  There is no
> > need to "release" them...
>
> I want something like Foxpro
>
> local m.lcVar
> ... processing..
> release m.lcVar
>
> I have my reason to release a variable early....
>
> --
>   .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
>  / v \  Simplicity is Beauty! May the Force and Farce be with you!
> /( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
>   ^ ^   20:47:02 up 3 days 1:41 0 users load average: 1.00 1.00 1.00
> news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
Author
12 Sep 2006 1:17 PM
Tracy McKibben
Man-wai Chang wrote:
> Aaron Bertrand [SQL Server MVP] wrote:
>> Variables are released when the proc/batch goes out of scope.  There is no
>> need to "release" them...
>
> I want something like Foxpro
>
> local m.lcVar
> ... processing..
> release m.lcVar
>
> I have my reason to release a variable early....
>

As Aaron said, you don't "release" variables in SQL.  Share your reason
with us, perhaps we can make a better suggestion.


--
Tracy McKibben
MCDBA
http://www.realsqlguy.com
Author
12 Sep 2006 1:23 PM
Aaron Bertrand [SQL Server MVP]
> I have my reason to release a variable early....

Could you explain instead of keeping it a secret?
Author
13 Sep 2006 11:18 AM
Man-wai Chang
Aaron Bertrand [SQL Server MVP] wrote:
>> I have my reason to release a variable early....
>
> Could you explain instead of keeping it a secret?
>
>

NO.. I give up. :)

--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
  ^ ^   19:18:01 up 4 days 12 min 0 users load average: 1.01 1.03 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
Author
13 Sep 2006 11:24 AM
Tibor Karaszi
> NO.. I give up. :)

The simple answer is that there is no way to "undeclare" a variable in TSQL. The reason why we asked
why you wanted to do this is so we can provide some workable advice instead of just saying "no".

Show quote
"Man-wai Chang" <toylet.toy***@gmail.com> wrote in message
news:OTXzfZy1GHA.4228@TK2MSFTNGP06.phx.gbl...
> Aaron Bertrand [SQL Server MVP] wrote:
>>> I have my reason to release a variable early....
>>
>> Could you explain instead of keeping it a secret?
>>
>>
>
> NO.. I give up. :)
>
> --
>  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
> / v \  Simplicity is Beauty! May the Force and Farce be with you!
> /( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
>  ^ ^   19:18:01 up 4 days 12 min 0 users load average: 1.01 1.03 1.00
> news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
Author
13 Sep 2006 11:28 AM
ML
How to dispose of a variable in a declarative programming language?
Don't use it. :)


ML

---
http://milambda.blogspot.com/

AddThis Social Bookmark Button