home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,652 of 19,505   
   Gene Wirchenko to All   
   How to Get Local Variables That Are Not    
   29 May 12 19:55:28   
   
   XPost: microsoft.public.sqlserver.programming   
   From: genew@ocis.net   
      
   Dear SQLers:   
      
        I have written a longish script.  I am up to just over 800 lines,   
   and there is way more to come yet.  In it, I define a number of stored   
   procedures.  I have test code for most of them.  My script looks   
   something like:   
             setup database   
             create tables and indexes   
             repeat n times   
                create procedure   
                test procedure   
             check table results   
             end off   
      
        I would like the option of easily turning off the testing.   
      
     1) I wish I could define a variable at the start of the script and   
   check that with each of my tests.  Unfortunately, the scope of a local   
   variable is but the batch it is defined in.  Or is there a way of   
   defining a longer-lived variable?   
      
     2) An alternative would be to create a table and insert a row to   
   indicate whether to test.  That would be a kludge.   
      
        T-SQL does seem to be missing some of the oddest things.  Is this   
   another case of that, or is it that I just do not know about nonlocal   
   variable declarations?   
      
   Sincerely,   
      
   Gene Wirchenko   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca