Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003
    Posts
    107

    Unanswered: SQL Server 7 Newbie

    I have a bunch of .sql files that will create a data model for me.
    I've created a new database in my SQL Server 7 Enterprise Manager called Test.
    How do i run this script? In part it looks like:

    create table AGP_TYPES (
    WL_AGP_TYPE VARCHAR2(4) not null,
    WL_AGP_TYPE_DESC VARCHAR2(40),
    constraint PK_AGP_TYPES primary key (WL_AGP_TYPE)
    )
    /


    create unique index PK_AGP_TYPES on AGP_TYPES (
    WL_AGP_TYPE ASC
    )
    /


    create table ALARM_SYSTEMS (
    WL_ALARM_TYPE VARCHAR2(4) not null,
    WL_ALARM_TYPE_DESC VARCHAR2(40),
    constraint PK_ALARM_SYSTEMS primary key (WL_ALARM_TYPE)
    )
    /


    create unique index PK_ALARM_SYSTEMS on ALARM_SYSTEMS (
    WL_ALARM_TYPE ASC
    )
    /

  2. #2
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    run the script in the sql server query analyzer.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Open it up in Query Analyzer and execute it, or use osql
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Feb 2003
    Posts
    107

    Where are the tables?

    Getting a lot of syntax errors:
    eg) all comments had to be removed.
    Also after each section the script had a "/", which had to be removed.
    Now i'm getting

    Server: Msg 156, Level 15, State 1, Line 5851
    Incorrect syntax near the keyword 'on'.


    The "on" it's referring to is at the end of the code block below where it says
    "on delete cascade"


    create table REHABCOSTS (
    REHAB_ID NUMBER(15) not null,
    SUBSIDY_ELIGIBLE VARCHAR2(3),
    COST_CATEGORY VARCHAR2(2),
    BENCHMARK_COST NUMBER(15),
    ROAD_SYSTEM_RATINGS CHAR,
    PRIORITY_RATING NUMBER(4),
    GUIDE_NUMBER NUMBER(5),
    CENTS_VEHICLE_KM NUMBER(6,2),
    COMPLETED_BY VARCHAR2(18),
    ROW_COST NUMBER(15),
    CONSTRUCTION_COST NUMBER(15),
    RESURFACING_COST NUMBER(15),
    DRAINAGE_COST NUMBER(15),
    BRIDGE_CULVERT_COST NUMBER(15),
    SIDEWALK_COST NUMBER(15),
    TRAFFIC_SIGNALS_COST NUMBER(15),
    UTILITIES_COST NUMBER(15),
    OTHER_COST_NAME1 VARCHAR2(10),
    OTHER_COST1 NUMBER(15),
    OTHER_COST_NAME2 VARCHAR2(10),
    OTHER_COST2 VARCHAR2(10),
    TOTAL_COST NUMBER(15),
    NON_SUBS_COST NUMBER(15),
    SUBSIDIZEABLE_COST NUMBER(15),
    MUNICIPAL_PERCENT NUMBER(3),
    MUNICIPAL_SHARE_COST NUMBER(15),
    constraint PK_REHABCOSTS primary key (REHAB_ID),
    constraint FK_REHABCOSTS_REHAB foreign key (REHAB_ID)
    references REHABILITATION (REHAB_ID)
    on delete cascade
    )

    Isn't SQL code universal? sorry, it might be a dumb question. But this code supposedly works for others....
    Last edited by dotolee; 12-21-04 at 13:01.

  5. #5
    Join Date
    Dec 2004
    Location
    California, USA
    Posts
    93
    If you want to run this script in Query Analyzer, find and replace the "/" with the word "go"
    Whoever imagines himself a favorite with God holds others in contempt. - Robert Green Ingersoll, lawyer and orator (1833-1899)

  6. #6
    Join Date
    Feb 2003
    Posts
    107

    Didn't create any new tables

    I tried using the "go" command... the system says that the command was run successfully but no tables have been created in the database!
    ??

    Code looks like:

    create table AGP_TYPES (
    WL_AGP_TYPE VARCHAR2(4) not null,
    WL_AGP_TYPE_DESC VARCHAR2(40),
    constraint PK_AGP_TYPES primary key (WL_AGP_TYPE)
    )
    go

    create unique index PK_AGP_TYPES on AGP_TYPES (
    WL_AGP_TYPE ASC
    )
    go
    create table ALARM_SYSTEMS (
    WL_ALARM_TYPE VARCHAR2(4) not null,
    WL_ALARM_TYPE_DESC VARCHAR2(40),
    constraint PK_ALARM_SYSTEMS primary key (WL_ALARM_TYPE)
    )
    go

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •