Cant get my head around this error???

  • Hi Guys, I am having some trouble getting a stored procedure to run, I think it is something to do with the Begin Go End statements but I am note sure please see below for the Errors and the offending lines! I was given this code and have not written it myself, although have been using sql for several months now in my current job!

    Msg 102, Level 15, State 1, Line 10

    Incorrect syntax near '='.

    Msg 102, Level 15, State 1, Line 28

    Incorrect syntax near '`'.

    Msg 102, Level 15, State 1, Line 1508

    Incorrect syntax near '`'.

    Msg 102, Level 15, State 1, Line 2040

    Incorrect syntax near '`'.

    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

    CREATE TABLE IF NOT EXISTS `StormHeader` (

    CREATE TABLE IF NOT EXISTS `StormHeaderLocUS` (

    CREATE TABLE IF NOT EXISTS `StormObservations` (

    If you need the full code then let me know, thanks for helping!

  • Full code.

    Also I'd try changing ` to real apostrophes (quick search / replace).

  • dave could that be mySQL that you pasted?

    the syntax doesn't match SQL server;

    the equivilent would be like this:

    IF Object_id('StormHeader') IS NULL

    CREATE TABLE StormHeader ( ...rest of definition

    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!

  • I think you'll find the SQL you've posted is for MySQL, not SQL Server.

    There is no such setting as SQL_MODE in SQL Server, and your conditional table creation isn't in SQL Server syntax

  • Hey Guys,

    Thanks for your replies, yup so looks like its mySQL is it a simple case of replacing those 4 lines of code with the SQL equivelent?

    I have tried pasting the entire code here but it errors, i think its too big is there any otherway I can send it?

    Here is a link the data I am trying to get into SQL > http://www.aoml.noaa.gov/hrd/hurdat/tracks1851to2010_atl_reanal.html

    Thanks again!

  • Thanks for the reply so do I need to change the other 4 error lines into SQL and not mySQL the file is too big to post on the forum!

    Many Thanls

  • Converting MySQL code to SQL Server code is far from a trivial exercise. You'll probably need to near-rewrite the whole thing.

    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

Viewing 7 posts - 1 through 6 (of 6 total)

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