Results 1 to 3 of 3

Thread: insert query

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Answers
    10

    insert query

    goodmorning,

    let us assume i have a table called dbo.Info with some data, for example:

    ClientID Name
    111 Phil
    112 Steve
    113 Victor
    114 Ralph
    . .
    . .
    . .

    okay, now i wanna add a new column to the table, suppose
    alter Table dbo.Info
    alter column Age int
    go

    so my question is i wanna make an insert script which insert data in Age for each Row

    sth like that; Insert into dbo.info (Age) values ('25') where name = 'steve'
    so i wanna insert each row by itself, how can i correct this script??

    10x in advance


  2. #2
    Junior Member
    Join Date
    Jun 2006
    Answers
    1

    Re: insert query

    well as you can see u have to actually parse through each row to get the names
    and also provide the script with correct age

    therefore use a cursor to pick the name
    and put an insert inside the cursor for that name
    insert into dbo.info (Age) where name = @valuegivenbythecursor


  3. #3
    Junior Member
    Join Date
    Jun 2008
    Answers
    10

    Re: insert query

    hey dipanjan,
    10x 4 ur help...plz, can u give me an example so it would be more clear?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact