sql server - Insert data to parent table and child table at thesame time sql -
i'm want insert data parent table child table 1 sql query.
i have 2 tables, users table , userinfo table
users table - parent table
- user_id - pk
- username
- password
userinfo table - child table
- user_id - fk parent table
- lastname
- firstname etc...
i'm using 2 inserts before have same user_id. there way in single query?
you view instead of insert trigger. i'm not saying that's best idea, could. also, wrap in stored procedure pass username, password, first name, last name, etc , proc handle 2 (or more) inserts you.
Comments
Post a Comment