Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2009

    Unanswered: Inserting data into one database from another database

    I have two databases im working with, one is our public database GRM_Public, and the other is our production database GRM_Prod.

    I'm trying to import data from a field called 'oldscreencodes1' from GRM_Prod.Transfer table into a field called 'Sale1Type' in GRM_Public.Real_land table.

    For some reason I can't get this to work, I have in the past imported datatables from our production DB to our public DB by using 'insert into' but I've never inserted data into a single field within a datatable and I think I'm over thinking this process.

    Is a 'join' necessary in order to accomplish this?

  2. #2
    Join Date
    Nov 2004
    on the wrong server
    Provided Answers: 6
    what error are you experiencing?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Jan 2003
    Provided Answers: 17
    Changing a single field of an existing row is an update. Creating a whole new row is an insert. Are you doing an insert, or an update?

  4. #4
    Join Date
    Aug 2004
    Dallas, Texas
    Quote Originally Posted by brian566 View Post
    I've never inserted data into a single field within a datatable and I think I'm over thinking this process.
    Look up in BOL or google positional and ordinal inserts. Or are you really just updating the column in destination table?

  5. #5
    Join Date
    Jul 2009
    ah ha, I need to use update, 'sale1type' is a new field I created within the GRM_public.real_land table that will store the sale code for each record/row for property that has sold.

    Only our production database stores these sales codes so I'm tryingn to import these into out public database for each parcel in the real_land table. I'll modify my query using update and I'll let you know if I have any problems.

    Thank You.

  6. #6
    Join Date
    Nov 2002
    Ya would be really helpful to see your code

    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.

  7. #7
    Join Date
    Jul 2009
    update real_land
    set sale1type=grm_prod.dbo.transfer.oldscreencode1
    from real_land inner join grm_prod.dbo.transfer
    on real_land.lrsn=Grm_prod.dbo.transfer.lrsn
    where sale1d=grm_prod.dbo.transfer.pxfer_date

    Here's my code.

    I was able to get the sale codes imported in to our public database with ease using this script. Thanks for the help

Posting Permissions

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