Bug or feature?

  • When running this mistyped query

    'select name, dbid sid, mode from master.dbo.sysdatabases order by dbid'

    from Management Studio against a SQL Server 2000 instance, I expect an error. Instead it happily executes the query, displaying and ordering by the sid column.

    Is this a bug or feature? Is it naive of me to expect the parser to raise a flag here? Am I too picky?

     

  • OK, my bad.

    I have always used the syntax colname AS newcolname, believing it was required, but as it turns out, it is optional.

  • Like you said it was not ordering by sid but was ordering by dbid but was dsiplaying dbid as sid (as is optional)

     

  • There isn't an setting anywhere to make it non-optional is there? Thus to alias a column you would have to write alias = column or column as alias.

  • you can put a quote on the alias name eg. select dbid 'sid' from sysdatabases

     

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

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