Thursday, June 5, 2008

Assigning Variables Values in SQL Server TSQL

This trips me up every now and again as I switch between coding SQL and coding other things.

The keyword SET is required before a variable assignment. I see to recall that BASIC use to have this requirement as well.

Example:
DECLARE @myInteger INT

SET @myInteger = 7