Table name

  • Hi there

    My hosting provider has created a table name starting with numbers if u do normal query it throws error can u advice how to query this table pls

    select * from 170703-test

    Error:

    Msg 170, Level 15, State 1, Line 1

    Line 1: Incorrect syntax near '170703'.

    Cheers

  • wrap any object name with brackets(or double quotes) if it doesn't follow normal naming conventions, has spaces in it, or are the same as a reserved word:

    select * from [170703-test]

    or

    select * from "170703-test"

    this could happen to database names,column names, procedure names, etc...not just tables.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

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