Why you are not getting error with this?????????

  • DECLARE @@@Temp TABLE(ID INT IDENTITY,TempID BIGINT)

    SELECT * FROM @@@Temp

  • dudekula.kareemulla (7/20/2015)


    DECLARE @@@Temp TABLE(ID INT IDENTITY,TempID BIGINT)

    SELECT * FROM @@@Temp

    It is a valid (table) variable name, no error in the code.

    😎

    For fun

    declare @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int = 1

    select @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  • Because there's nothing wrong with that syntax.

    https://msdn.microsoft.com/en-us/library/ms175874.aspx

    Rules for Regular Identifiers

    The names of variables, functions, and stored procedures must comply with the following rules for Transact-SQL identifiers.

    The first character must be one of the following:

    * A letter as defined by the Unicode Standard 3.2. The Unicode definition of letters includes Latin characters from a through z, from A through Z, and also letter characters from other languages.

    * The underscore (_), at sign (@), or number sign (#).

    Certain symbols at the beginning of an identifier have special meaning in SQL Server. A regular identifier that starts with the at sign always denotes a local variable or parameter and cannot be used as the name of any other type of object. An identifier that starts with a number sign denotes a temporary table or procedure. An identifier that starts with double number signs (##) denotes a global temporary object. Although the number sign or double number sign characters can be used to begin the names of other types of objects, we do not recommend this practice.

    Some Transact-SQL functions have names that start with double at signs (@@). To avoid confusion with these functions, you should not use names that start with @@.

    Subsequent characters can include the following:

    * Letters as defined in the Unicode Standard 3.2.

    * Decimal numbers from either Basic Latin or other national scripts.

    * The at sign, dollar sign ($), number sign, or underscore.

    CREATE TABLE #@#@#@#@#@#@#@#@#@ (

    Id INT

    )

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • It may be legal, but that doesn't mean we can't scoff at it.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply