Simple Question from a complete newbie

  • Please can someone take aquick glance at this code and let me know what is wrong.

    I am a coplete newbie who has just started learning SQL so this is probably the easiest answer ever!

    CREATE TABLE CUSTOMER_DATA

    ( MPAN INT,

    EAC INT,

    GSP INT,

    CUSTOMER_NAME VARCHAR(60) ) ;

    INSERT INTO CUSTOMER_DATA ( MPAN, EAC, GSP, CUSTOMER_NAME )

    VALUES ( 1234, 1000, 10, 'Company1' ) ;

    Thanks in advance

  • Can't see anything wrong with that code, what is the problem you are having?

  • I don't see any syntax errors in your SQL statement. Is it doing something you are not expecting, or throwing some sort of error message?

    -Luke.

    To help us help you read this[/url]For better help with performance problems please read this[/url]

  • Thanks for the quick reply guys.

    The error I am getting is as follows:

    "Syntax error in Create Table statement"

    Any ideas?

  • That doesn't even sound like a SQL Server error. SQL's would be something like

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'CREATE'.

    Are you using Microsoft SQL Server here? Or is it maybe something else (MySQL, Oracle, MS Access)

    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
  • To my shame I am indeed using Access to learn the basics as I am waiting for SAS to be installed onto my laptop.

    I have just asked one of the IS guys at the office and he has pointed out that you can only run SQL querries one at a time in Access. As I was trying to do more than one querry at a time, this is where the problem lies.

    Thanks for your time guys. I have no doubt that I will be on this forum again come Monday!

    Ross

  • The SQL language used by MS Access and MS SQL Server is similar, but not the same. Hence, if you're not using SQL Server itself, please tell us what you are using, otherwise the advice you get will be fairly worthless

    If you're using MS Access and querying against MS Access tables, I suspect your CREATE TABLE will still fail. Varchar is a SQL Server data type, not one that MS Access has (there it'll be text(50) I believe)

    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 7 (of 7 total)

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