• Christian Buettner-167247 (5/4/2010)


    One important observation: This is an error caused within the client tool, not within SQL Server. Query Analyzer has no issues; SQL Server management Studio does have the issue.

    ...

    SQL Server Query Analyzer will execute the code without error, and SQL Server Management Studio will error only for "SELECT @a".

    To me it looks like this is an issue with incorrect metadata being returned. The data itself obviously seems to be correct.

    Edit: sqlcmd does not throw an error either - so this seems to be an issue with SSMS only.

    Results may depend on session SETtings which may be different for those tools.

    What does the following return for you in each client tool?

    SELECT S.quoted_identifier,

    S.arithabort,

    S.ansi_null_dflt_on,

    S.ansi_defaults,

    S.ansi_warnings,

    S.ansi_padding,

    S.ansi_nulls,

    S.concat_null_yields_null

    FROM sys.dm_exec_sessions S

    WHERE session_id = @@SPID;