sql server - How do I insert a record from one table into another table? -


i trying set couple tables, , noticed error, created blank database , tried recreate error.

the error reads "the columns in table "" not match existing primary key or unique constraint.

now i've read site, has primary key.

however want (my primary concern) have 1 table, have roles, salaries , job description in 1 table, , in table, have names, , roles. example, if there 2 accountants in 2nd table, 1 accountant entry in first table apply twice second table. doing have let's 20 "roles" , 30 employees unique roles, same roles.

how set table work way?

ps:

i using sql server management studio create database (which creating scratch). how created problem, created table , inserted 2 columns, column 1 rolesid, , column 2 salary. in second table made of 2 columns, column 1 name, , column 2 position. add 3rd column table 2, labelled salary (or pay or something) in if had 2 of same roleid 2 different names, 3rd table give salary. haven't inserted triggers yet.

for added clarity: possible, have table of possible roles + salaries, , add different table automatically? if put name a, b, , c, , have role a, , b, have salary automatically update a, b , c accordingly, having specify role

i wasn't thinking apparently.

the simple solution add identifier codes (ids) every table want represent.

for this, had 1 table salary, , 1 table roles , 1 table contacts.

on master table, put column each of ids - contact id, salary id, , role id. fill in id's on master table.

i simple put id numbers each person on table, , on reporting software placed proper salaries , roles me.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -