>>>>Personally I use SELECT @@IDENTITY or even SELECT CAST(0 as bit) , but query any other system variable will do the same.
>>>
>>>Both you and Dragan know only about 1000 times more than I do :)
>>>
>>>I wish there was a definitive way to find out which one is faster Select @@version or SELECT @@IDENTITY. For me, the resulting number is not important. Only if the SELECT worked or no.
>>>
>>>Thank you!
>>
>>
>>SELECT @@VERSION -- Returns nvarchar variable, not sure how long it is
>>SELECT @@IDENTITY -- Returns 4 byte int
>>SELECT CAST(0 as bit) - returns 1 bit.
>>
>
>When I run SELECT @@IDENTITY in my SSMS (of SQL 2008), the returned value is NULL. Why?
:-)
Because you did not insert any record in a table with identity field.
>
>Also, how is SELECT CAST(0 as bit) different from SELECT ""? That is, neither one (as far as I know) hits the SQL Server. No?
Both hits SQL Server.
SELECT "" should return error becuase you should round string in single quotes.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.