• One comment -- the syntax of the question only works on SQL 2008 and up. This line:

    DECLARE @a VARCHAR ='xyz'

    is not supported on earlier versions; you have to declare and select as two steps.