|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
The opposite to DECLARE..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 Variables are released when the proc/batch goes out of scope. There is no
need to "release" them... Show quoteHide 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 Well, except for Cursors. For Cursors you can use DEALLOCATE
Show quoteHide 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 > > Aaron Bertrand [SQL Server MVP] wrote:
> Variables are released when the proc/batch goes out of scope. There is no I want something like Foxpro> need to "release" them... 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 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 quoteHide 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 Man-wai Chang wrote:
> Aaron Bertrand [SQL Server MVP] wrote: As Aaron said, you don't "release" variables in SQL. Share your reason>> 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.... > with us, perhaps we can make a better suggestion. > I have my reason to release a variable early.... Could you explain instead of keeping it a secret?Aaron Bertrand [SQL Server MVP] wrote:
>> I have my reason to release a variable early.... NO.. I give up. :)> > Could you explain instead of keeping it a secret? > > -- .~. 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 > 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 quoteHide quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "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 How to dispose of a variable in a declarative programming language?
Don't use it. :) ML --- http://milambda.blogspot.com/
Other interesting topics
Help me performance optimize
Strange result Programatically Accessing Maintenance Plans through SMO Cannot see system views? How to calculate a 5 minute running average? Tree table Script for importing Windows active directory domain user accounts? How do I run a DTS package from vb.net Two instances of sql on one server causes problems Need CheckSum Algorithm |
|||||||||||||||||||||||