Subject | How do I test for a value before an INSERT? |
---|---|
Author | Derek Basch |
Post date | 2002-06-05T07:33:53Z |
Hi,
Im new to SQL and I have created several tables and
would like to be able to INSERT to several of them at
the same time. I cant seem to find any
examples/techniques for breaking apart records and
inserting into multiple tables.
For example:
---t_emp_info---
pk_emp_id
fk_job
fname
lname
---t_job_title---
pk_job
job_title
Now, what if I want to add a new employee and a job
title? I will obviously need 2 INSERT's, right? I
would like to insert the emp_info and then the
job_title ONLY if the title doesnt already exist in
the t_job_title table. Can I do this?
Thanks,
Derek Basch
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Im new to SQL and I have created several tables and
would like to be able to INSERT to several of them at
the same time. I cant seem to find any
examples/techniques for breaking apart records and
inserting into multiple tables.
For example:
---t_emp_info---
pk_emp_id
fk_job
fname
lname
---t_job_title---
pk_job
job_title
Now, what if I want to add a new employee and a job
title? I will obviously need 2 INSERT's, right? I
would like to insert the emp_info and then the
job_title ONLY if the title doesnt already exist in
the t_job_title table. Can I do this?
Thanks,
Derek Basch
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com