Error Message Help

  • this is the Error message:

    Msg 102, Level 15, State 1, Line 5

    This is the T-SQL

    USE Master;

    GO

    CREATE DATABASE Tester;

    GO

    USE Tester

    GO

    CREATE TABLE dbo.Roles

    (

    RoleID int NOT NULL,

    RoleName varchar (15) NULL,

    CONSTRAINT PK_RoleID PRIMARY KEY (RoleID)

    )

    GO

    CREATE TABLE dbo.Person

    (

    PersonID int NOT NULL,

    LastName varchar (15) NULL,

    FirstName varchar (15) NULL,

    RoleID int NULL references dbo.Roles

    CONSTRAINT PK_PersonID PRIMARY KEY (PersonID)

    )

    GO

    CREATE TABLE dbo.Category

    (

    CategoryID int NOT NULL,

    Category varchar (30) NULL,

    CONSTRAINT PK_CategoryID PRIMARY KEY (CategoryID)

    )

    GO

    CREATE TABLE dbo.Tests

    (

    TestID int NOT NULL,

    TestName varchar (30) NULL,

    CategoryID int NULL references dbo.category

    CONSTRAINT PK_TestID PRIMARY KEY (TestID)

    )

    GO

    CREATE TABLE dbo.question

    (

    QuestionID int NOT NULL,

    QuestionText varchar (200) NULL,

    Explanation varchar (300) NULL,

    Reference varchar (200) NULL,

    TestID int NULL references dbo.Tests

    CONSTRAINT PK_QuestionID PRIMARY KEY (QuestionID)

    )

    GO

    CREATE TABLE dbo.Answer

    (

    AnswerID int NOT NULL,

    AnswerText varchar (300) NULL,

    CorrectAnswer bit NULL,

    QuestionID int NOT NULL references dbo.question

    CONSTRAINT PK_AnswerID PRIMARY KEY (AnswerID)

    )

    GO

    CREATE TABLE dbo.TestHistory

    (

    TestHistoryID int NOT NULL,

    PersonID int NULL references dbo.Person

    TestID int NULL references dbo.Tests

    DateTaken datetime NULL,

    Score decimal(4,2) NULL

    CONSTRAINT PK_TestHistoryID PRIMARY KEY (TestHistoryID)

    )

    GO

    now what does

    Msg 102, Level 15, State 1, Line 5 means?

    102 refers to what?

    what is level 15?

    State 1?

    Line 5 is which one?

    Thanks for your help

  • Hello,

    You are missing a couple of commas at the ends of your Column definitions in the Create table dbo.TestHistory statement.

    If you are using SSMS you can double-click the Error Message in the Result Pane and SSMS will (usually) highlight the offending code in the Query Pane.

    Please see the SQL Server Books Online Topic “Understanding Database Engine Errors” for details of Error Numbers, Severities and States.

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • Yep, just missing two commas.

    Thank you so much.

    John Marsh (2/25/2009)


    Hello,

    You are missing a couple of commas at the ends of your Column definitions in the Create table dbo.TestHistory statement.

    If you are using SSMS you can double-click the Error Message in the Result Pane and SSMS will (usually) highlight the offending code in the Query Pane.

    Please see the SQL Server Books Online Topic “Understanding Database Engine Errors” for details of Error Numbers, Severities and States.

    Regards,

    John Marsh

  • For next time just remember to double-click on the error in the results pane; most of the time it will get you into the "general vicinity" of the error. Exceptions are dynamic sql, others.

    Take care

  • Thanks.

    Now I learned something new.

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

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