sql server - Sql design for the employee details and salary table. where employee code are not repeat in employee details and find salry,employee name,designation -


i want how fetch employee salary information , employee_code,first_name,through both table , want see salary of employee such employee ramesh salary 1000 rs.. , changes in tbl_basic_salary on basis of employee code.

tbl_addnew_employee here employee information  employee_id primary key  employee_id int  employee_code   varchar(200)=null  first_name  varchar(200)=null  last_name   varchar(200)=null  user_name   varchar(400)=null  father_name varchar(200)=null  mother_name varchar(200)=null  gender  varchar(50)=null department  varchar(200)=null  designation varchar(200)=null  profile_pic varchar(200)=null  address varchar(200)=null   second table tbl_basic_salary   salary_id primary keys  salary_id   int   basic_salary decimal(18, 0)=null  salary_type varchar(50)=null   ,  add information details of employee , employee_code unique every employee  alter procedure [dbo].[usp_addnew_employee]   -- add parameters stored procedure here    @employee_code                varchar(200)=null,    @first_name                   varchar(200)=null,    @last_name                    varchar(200)=null,    @user_name                    varchar(400)=null,    @father_name                  varchar(200)=null,    @mother_name                  varchar(200)=null,    @gender                      varchar(200)=null,    @department                   varchar(200)=null,    @designation                  varchar(200)=null,    @profile_pic                  varchar(200)=null,    @filename                      varchar(500)=null,    @file_extension                varchar(10)=null,      enter code here    @address               varchar(200)=null,  begin    --*********for add products information***************************************************------        declare @currentid varchar(500)     declare @newfilename varchar(500)    if(@calltype='add_employee_info')   begin     if exists(select employee_id tbl_addnew_employee employee_code=@employee_code)   begin      select 1 success     end else    begin        insert tbl_addnew_employee        (        employee_code,first_name,last_name,father_name,mother_name,gender,department,        designation,profile_pic,address,           )         values        (        @employee_code,@first_name,@last_name,@father_name,@mother_name,@gender,@department,        @designation,@profile_pic,@address,        )      set @currentid=(select @@identity)       set @newfilename=@filename+'_'+@currentid +'.'+@file_extension        update tbl_addnew_employee set profile_pic=@newfilename     employee_id=@currentid                         select @newfilename scucess       end   end 

i want how fetch employee salary information , employee_code,first_name,through both table , want see salary of employee such employee ramesh salary 1000 rs.. , changes in tbl_basic_salary on basis of employee code.

currently there no mapping between tbl_addnew_employee , tbl_basic_salary following way can implement mapping based on requirement...

  1. in tbl_basic_salary table, add employee_id column , create foreign key constraint tbl_addnew_employee.

  2. the second can create new assoc table , add employee_id , salary_id column , create foreign key constraint both tables. @ time of inserting data have insert @@identity of both tables new associatoin table.

now use sql joins retrieve results.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -