What was erroe in my code?

  • Hai friends,

    i ve the table like

    users:

    -=====

    create table users

    (

    users_id varchar(10) primarykey,

    username varchar(10),

    pwd varchar(10)

    )

    insert into users('001','A','ra@123')

    insert into users('005','G','hat@123')

    travel_request:

    ============

    create table travel_request

    (

    request_id int identity primary key,

    user_id varchar(10) foreign key references users(user_id),

    travel_purpose varchar(10),

    total_amount varchar(10)

    )

    onward_journey:

    ============

    create table onward_journey

    (

    onward_joureny_id int identity,

    request_id int foreign key references travel_request(request_id),

    departuredate datetime,

    from_place varchar(10),

    to_place varchar(10),

    metro varchar(10)

    )

    in the username 'A' logged and made travel request in that request_id depends on onwards_journey data's filled it.....

    how to do that for different users and one more think "A" request doesn't show to 'G".

    if the same date appeared means it wont allow and below date not allow to insert.

    is these mY procedure for correct ah:

    ============================

    alter procedure Insert_Journey

    (

    @departuredate datetime,

    @from_location varchar(50),

    @to_location varchar(50),

    @metro nvarchar(50),

    @trans_all nvarchar(50),

    @mode_of_travel nvarchar(50),

    @seat_type nvarchar(50),

    @no_of_days int,

    @other_details varchar(50),

    @status_id int,

    @request int

    )

    as

    BEGIN

    DECLARE @MaxDate datetime

    select @request=max(request_id) from travel_request

    SELECT @MaxDate = MAX(DepartureDate) FROM onward_journey

    IF(@MaxDate > @departuredate)

    BEGIN

    RAISERROR('Your error message for departuredate should be greater then maxdate',16,1)

    RETURN

    END

    insert into onward_journey(departuredate,from_location,to_location,metro,trans_all,mode_of_travel,seat_type,no_of_days,other_details,status_id,request_id) values(@departuredate,@from_location,@to_location,@metro,@trans_all,@mode_of_travel,@seat_type,@no_of_days,@other_details,'2',@request)

    END

    its not working?

  • It's so full of spelling errors it's difficult to say

    e.g. 'priamrykey' in users table definition won't compile.

    Can you correct the typos & give a bit more detail about the error?

Viewing 2 posts - 1 through 1 (of 1 total)

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