Select data from one table to another.

  • Good day all,

    I am re-writing an existing Access app to SQL server 2000 and

    I have just started to put a SP together and for reasons unknown the SP does not like the name of a particular table. The table is named 15cm and the code itself is simple enough:

    SELECT *

    INTO NewTable

    FROM 15cm

    GO

    The 15cm table itself is fine, I can open and view it but SP does not like the syntax. I tried encasing it in both '' and "" but no joy. Using another table works fine so the syntax itself is OK but using the table I want to use throws a fit.

    I can't believe the naming of the table is causing a problem so can any point out something I may have missed ?

    Thanks in advance,

    Mitch....

  • It is the naming that's causing a problem as a table name may not start with a number.

    SELECT *

    INTO NewTable

    FROM [15cm]

    GO

    Just an additional note, if this is anything other than a once-off, consider specifying the columns and not using SELECT *

    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
  • Thanks Gail, that worked perfect.

    Cheers for the advice, at the moment I am just testing the tables but this may well become a monthly task so I may well list each field.

    Thanks again,

    Mitch.

  • I would also question why you are moving to SQL Server 2000. You really should be moving to 2008 since that is the most current version of SQL Server. Moving to SQL Server 2000 just means you are going to have to upgrade later.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • I'd agree with Jeff here. If you have a 2008 instance, use that. If all you have are 2000 instances, then go with what you have.

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

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