Results 1 to 2 of 2

Thread: not in tab1 or not in tab2

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    Question not in tab1 or not in tab2

    My table 1 and tab2 both have primary key call student_id , if I want to do if the id is not in tab1 or not in tab2 then do insert ???

  2. #2
    Join Date
    Feb 2011
    Posts
    7
    if exists(select tab1.student_id,tab2.student_id from tab1,tab2 where tab1.student_id=@student_id or tab2.student_id=@student_id )
    begin
    ////code when a student_id exists
    end
    else
    //// Insert query
    begin
    end

Posting Permissions

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