Field names with hyphens

  • Hello,

    We have a developer who is trying to run the following script:

    UPDATE DB59.OBCBusinessFrameworkDatabase.dbo.TRIOWSCMigration

    SET [DB34-WSC] = N.[DB34-WSC]

    FROM DB59.OBCBusinessFrameworkDatabase.dbo.TRIOWSCMigration M

    JOIN BFDOrderTrackingDatabase.dbo.TRIOWSCMigration N ON M.TRIOMigrationID = N.TRIOMigrationID

    Each time he gets the same error message:

    Msg 8180, Level 16, State 1, Line 1

    Statement(s) could not be prepared.

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near '-'.

    DB59 is a remote

  • Is the remote server SQL Server, or something else?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Sorry, posted before i had finished.

    DB59 is a remote server but on the same LAN, we have no control over the field names (or I would have removed the damn hyphen)

    We have tried all the bracketseven a cast the only time it runs is if we surround the N.[DB34-WCS] with an isnull, which we don't want to do

    Thanks

    Andy

  • Andrew Clark-151434 (10/13/2011)


    Sorry, posted before i had finished.

    DB59 is a remote server but on the same LAN, we have no control over the field names (or I would have removed the damn hyphen)

    We have tried all the bracketseven a cast the only time it runs is if we surround the N.[DB34-WCS] with an isnull, which we don't want to do

    Thanks

    Andy

    Is the remote server SQL Server or some other system, like Oracle or DB2?

  • Thanks for the reply. The local server is SQL 2000 SP4 and the remote (DB59) is SQL 2005 SP2

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

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