Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011
    Posts
    2

    Unanswered: Batch File - Read from one table and write to another db and table

    Does anyone know of an easy way for a batch file or automated process to read from one db and table and what ever entry is missing out of another database + table it writes those missing entries to.

    This is a simple table in one db that is filled with usernames, I want to see if there are missing usernames in another db and table and write those entries.

    db1.usr_table.usr_name = jdoenew

    If jdoenew is missing in the 2nd db I will need to write entries like:
    db1.usr_table.usr_name = jdoenew
    db1.usr_table.password = tmppassword
    db1.usr_table.active = 1

    Thanks in advance

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Have a look at the MERGE statement.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

Posting Permissions

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