update for My table?

  • Hai friends,

    my table structure is

    create table journey

    (

    journey_id int identity,

    fromplace varchar(44),

    toplace varchar(44),

    mode nvarchar(20),

    seattype nvarchar(20),

    status_id int

    )

    insert into journey '2013-05-10','chennai','Mumbai','Air','Business','2'

    how to write fro update for these table depends on journey_id?

    i m tried its not reflecting?

  • A sample data of 1 rows might not be enough

    Please provide a few more rows to replicate the issue properly

    Now, the main questions, What do you want to update and How?

    It would be better if you explain a bit more with more sample data and expected results.

    raghuldrag (6/7/2013)


    i m tried its not reflecting?

    What have you tried? Can you show us the code, may be that will give some idea as well.


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Hai...

    insert into journey '2013-05-10','chennai','Mumbai','Air','Business','2'

    insert into journey '2013-05-12','Mumbai','chennai','Air','Business','2'

    insert into journey '2013-05-14','chennai','Banglore','Air','Business','2'

    insert into journey '2013-05-16','Banglore','Chennai','Air','Business','2'

    insert into journey '2013-05-18','chennai','Chennai','Local','Local Travel','2'

    if suppose wanna update 10th may-13 data's depends on auto increment id how to write update code?

  • Your requirement is still not very clear. Which is the column you want to update and How?

    raghuldrag (6/7/2013)


    if suppose wanna update 10th may-13 data's depends on auto increment id how to write update code?

    Can you phrase this in a different manner?


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • hai friend,

    if suppose choose the first row of the table,

    create table journey

    (

    journey_id int identity,

    depdate datetime,

    fromplace varchar(20),

    toplace varchar(20),

    mode nvarchar(20),

    seattype nvarchar(20),

    )

    insert into journey (deapdate,fromplace,toplace,mode,seattype) values ('2013-05-13', 'chennai','Banglore','air','Business')

    insert into journey (deapdate,fromplace,toplace,mode,seattype) values ('2013-05-14', 'Banglore','Mumbai','air','Business')

    insert into journey (deapdate,fromplace,toplace,mode,seattype) values ('2013-05-15', '','CHENNAI','air','Business')

    if suppose wanna update entire data of 13th may depends on journey id

    how make code?

  • raghuldrag (6/7/2013)


    hai friend,

    if suppose choose the first row of the table,

    create table journey

    (

    journey_id int identity,

    depdate datetime,

    fromplace varchar(20),

    toplace varchar(20),

    mode nvarchar(20),

    seattype nvarchar(20),

    )

    insert into journey (deapdate,fromplace,toplace,mode,seattype) values ('2013-05-13', 'chennai','Banglore','air','Business')

    insert into journey (deapdate,fromplace,toplace,mode,seattype) values ('2013-05-14', 'Banglore','Mumbai','air','Business')

    insert into journey (deapdate,fromplace,toplace,mode,seattype) values ('2013-05-15', '','CHENNAI','air','Business')

    if suppose wanna update entire data of 13th may depends on journey id

    how make code?

    I am still not very clear. But, I think you need on of the below queries.

    UPDATEjourney

    SETdeapdate = <<Some New Value>>,

    fromplace = <<Some New Value>>,

    toplace = <<Some New Value>>,

    mode = <<Some New Value>>,

    seattype = <<Some New Value>>

    WHEREjourney_id = <<Value>>

    -- OR

    UPDATEjourney

    SETfromplace = <<Some New Value>>,

    toplace = <<Some New Value>>,

    mode = <<Some New Value>>,

    seattype = <<Some New Value>>

    WHEREdeapdate = '2013-05-13 00:00:00.000'

    If this is not what you were looking for, explain the issue a bit more or give us the code you have tried( may be that will help up understand )


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

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

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