Re: Exclusive Query

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 09/10/04

  • Next message: Nigel Rivett: "RE: Server identifier"
    Date: Sat, 11 Sep 2004 03:12:54 +0530
    
    

    i dont know why it shouldn't work. are you getting any error?
    see following example.

    create table table1(id int)
    create table table2(id int)

    insert into table1 values(1)
    insert into table1 values(2)
    insert into table1 values(3)
    insert into table2 values(1)
    insert into table2 values(2)

    INSERT INTO table2 ( id )
    SELECT table1.id FROM table1 WHERE NOT EXISTS
    ( SELECT table2.id FROM table2 WHERE table1.id = table2.id )

    -- 
    Vishal Parkar
    vgparkar@yahoo.co.in | vgparkar@hotmail.com
    

  • Next message: Nigel Rivett: "RE: Server identifier"

    Relevant Pages

    • Re: Text column copy across tables
      ... existing rows in TABLE1 using data present in the text column of a ... corresponding row in TABLE2. ... create table t(i int, t text) ... Don't forget to set textsize if datalength of the textfield ...
      (comp.databases.sybase)
    • Re: SQL Comparison of ISNULL values
      ... Can you show the exact results you want? ... ID INT, ... INSERT table1 SELECT 2, NULL ... INSERT table2 SELECT 3, NULL ...
      (microsoft.public.sqlserver.programming)
    • Re: ADP/SQL Data Selection Criteria in a Stored Procedure
      ... create table table1 (Client_Id int, DateEntered datetime, Employee_ID int) ... create table table2 ... > result in SP and return as a report row source in ADP. ...
      (microsoft.public.sqlserver.programming)
    • Re: Importing xml through tsql
      ... declare @h int ... --insert into table1 ... --insert into table2 ... > I want to upload xml data with sql's openxml. ...
      (microsoft.public.sqlserver.xml)
    • Help with Query
      ... I need a query that will do these things. ... The row that is returned will always have the higher ChildID ... All fields are int, with the exception of DEL_IND being tinyint. ... INSERT INTO Table1 VALUES ...
      (microsoft.public.sqlserver.programming)