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,473 of 19,505   
   Bob Barrows to Tony C.   
   Re: One more thing I don't understand in   
   02 Oct 11 15:25:18   
   
   From: reb01501@NOSPAMyahoo.com   
      
   Tony C. wrote:   
   > However, this does return a resultset.   
   >   
   >   
   > select @BeginProcessControlDate as BeginProcessControlDate,   
   > @EndProcessControlDate as EndProcessControlDate,   
   >        count(*) as UsageGroupCount   
   >   from CabsUsageGroupHC;   
   >   
   >   
   > only diff is SELECT @variable AS  instead   
   > of SELECT @variable =   
   >   
   > could that be the difference?   
      
   Almost, but not quite. These two statements are equivalent:   
      
   select @BeginProcessControlDate as BeginProcessControlDate   
   select BeginProcessControlDate = @BeginProcessControlDate   
      
   The point is, you have to analyze what is happening. In both of these   
   statements, a column called "BeginProcessControlDate" is being created, set   
   to the value of @BeginProcessControlDate, and being returned in the   
   resultset.   
      
   With a statement like:   
   select @BeginProcessControlDate = BeginProcessControlDate   
      
   the variable @BeginProcessControlDate is being assigned the value contained   
   in a table column called BeginProcessControlDate. If that column does not   
   exist in the table, an error will result.   
      
   So it's not simply a matter of looking for select clauses containing "="   
   operators as opposed to "AS" operators. You have to analyze what the   
   statements are doing.   
      
   --- 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