Well, it's quite simple.
 
@@IDENTITY is a global variable (connection specific though!), and is NOT bound to any 
table or field.
 
Thus, when you trigger an identity increment the @@IDENTITY variable is filled with 
the result. Now this variable has to be 'generic', and in order to be able to store 
any valuetype incremented using the identity feature, it must have room for the 
largest value, ie decimal.
 
BTW: It was a decimal in ADO as well.
 
Seems logical to me...
 
Morty
 

        -----Original Message----- 
        From: Jim Arnold [mailto:[EMAIL PROTECTED]] 
        Sent: Tue 5/28/2002 7:41 PM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: [DOTNET] Return type of @@IDENTITY
        
        

        Can anyone explain why SQL Server's @@IDENTITY field is returned as a
        System.Decimal from the managed provider, regardless of the column's SQL
        type (int in this case)?  Or at least can they confirm that it is always
        Decimal, and doesn't vary?  Smells like laziness in the TDS parser, but I
        just wanted a sanity check.
        
        cheers,
        
        Jim
        
        You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
        subscribe to other DevelopMentor lists at http://discuss.develop.com.
        

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to