DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Paul Dionne Guest

    Update from second table

    I am trying to update the values of one table based on a second table where
    the LogonNames are identical in both tables.

    UPDATE memSecurity INNER JOIN tmptblSecurityImport ON memSecurity.LogonName
    = tmptblSecurityImport.LogonName SET memSecurity.ExpDate =
    tmptblSecurityImport.ExpDate;

    Works in MSAccess but not in SQL7. What am I overlooking?

    Paul Dionne




  2. #2
    Jason Rein Guest

    Re: Update from second table


    Simple syntax problem here. In SQL, the SET clause comes before the JOINs
    and you have to specify the tables in a FROM clause.

    UPDATE memSecurity
    SET ExpDate = tmptblSecurityImport.ExpDate
    FROM memSecurity
    INNER JOIN tmptblSecurityImport ON memSecurity.LogonName
    = tmptblSecurityImport.LogonName

    - Jason

    "Paul Dionne" <P-IHATESPAM-Dionne@Kreative.net> wrote:
    >I am trying to update the values of one table based on a second table where
    >the LogonNames are identical in both tables.
    >
    >UPDATE memSecurity INNER JOIN tmptblSecurityImport ON memSecurity.LogonName
    >= tmptblSecurityImport.LogonName SET memSecurity.ExpDate =
    >tmptblSecurityImport.ExpDate;
    >
    >Works in MSAccess but not in SQL7. What am I overlooking?
    >
    >Paul Dionne
    >
    >
    >



  3. #3
    Paul Dionne Guest

    Re: Update from second table

    Thanks, it worked

    Jason Rein wrote in message <38df7bf2@news.devx.com>...
    >
    >Simple syntax problem here. In SQL, the SET clause comes before the JOINs
    >and you have to specify the tables in a FROM clause.
    >
    >UPDATE memSecurity
    >SET ExpDate = tmptblSecurityImport.ExpDate
    >FROM memSecurity
    >INNER JOIN tmptblSecurityImport ON memSecurity.LogonName
    >= tmptblSecurityImport.LogonName
    >
    >- Jason
    >
    >"Paul Dionne" <P-IHATESPAM-Dionne@Kreative.net> wrote:
    >>I am trying to update the values of one table based on a second table

    where
    >>the LogonNames are identical in both tables.
    >>
    >>UPDATE memSecurity INNER JOIN tmptblSecurityImport ON

    memSecurity.LogonName
    >>= tmptblSecurityImport.LogonName SET memSecurity.ExpDate =
    >>tmptblSecurityImport.ExpDate;
    >>
    >>Works in MSAccess but not in SQL7. What am I overlooking?
    >>
    >>Paul Dionne
    >>
    >>
    >>

    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links