Insert

  • Can anybody help me in insert statement:

    I have a table say table 1 which has many columns but out of these one column say Tid is null and all other columns has records in it.

    I do have another table2 which has column pid.

    I am trying to get the records from column pid table2 and insert it into Tid in table1

    . How can i do it?

    Urgent please help me out...

    Thanks..

  • Beginner_2008 (9/14/2011)


    Can anybody help me in insert statement:

    I have a table say table 1 which has many columns but out of these one column say Tid is null and all other columns has records in it.

    I do have another table2 which has column pid.

    I am trying to get the records from column pid table2 and insert it into Tid in table1

    . How can i do it?

    Urgent please help me out...

    Thanks..

    Awful thin on the details...

    you have to be able to establish some sort of relationship between the two tables. without that information, it's a crapshoot.

    syntax wise, it goes something like this: i took a lot of liberties ont eh assumptions.

    UPDATE TABLE1

    SET TABLE1.PID = TABLE2.TID

    FROM TABLE2

    WHERE TABLE1.CONTACTTBLKEY=TABLE2.CONTACTTBLKEY

    AND TABLE1.PID IS NULL

    AND TABLE2.TID IS NOT NULL

    AND STATE = 'FL'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks,

    I used export and import wizard . but it was urgent in the time..

  • Thanks for the information.

  • CELKO (9/15/2011)


    ...

    Rows are not records; records are not values it is a HUGE difference that you will nee to learn. Please post DDL and not a vague, useless narration (can you program from this??!! Me neither.).

    My guess is that you want a MERGE statement ...

    I call rows - records, and genuinely believe that records can contain values. I don't see ANY difference and i have no urge to learn it.:-P

    Questions better to be posted with accordance to forum etiquette which you can read about if you click the link at the bottom of my signature.

    So my guess is:

    Follow the above advise and you will get relevant help!

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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