E
engahmedbarbary
Guest
Problem
How to copy exist record on table to new row with same data but different ID ?
I have table name Employee as following
CREATE TABLE [dbo].[Employees](
[EmployeeId] [int] NOT NULL,
[EmployeeName] [nvarchar](max) NULL,
[EmployeeAge] [int] NOT NULL,
[BirthDate] [datetime2](7) NOT NULL,
CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED
(
[EmployeeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
and data Sample
EmployeeId EmployeeName EmployeeAge BirthDate
1 micheel 33 1985-01-10 00:00:00.0000000
2 elias 28 1990-02-25 00:00:00.0000000
4 adel 22 1995-12-12 00:00:00.0000000
5 gorg 38 1980-12-01 00:00:00.0000000
Actually I need to copy data of EmployeeId number 4 to New record Number 6
and different name as mariam so that record number 6 will be as following
6 mariam 22 1995-12-12 00:00:00.0000000
I work on sql server 2012 visual studio 2015 and i use c# language and i using ado.net technique
so that how to copy exist row to new row but change only will be in two fields
EmployeeId and EmployeeName
thanks
Continue reading...
How to copy exist record on table to new row with same data but different ID ?
I have table name Employee as following
CREATE TABLE [dbo].[Employees](
[EmployeeId] [int] NOT NULL,
[EmployeeName] [nvarchar](max) NULL,
[EmployeeAge] [int] NOT NULL,
[BirthDate] [datetime2](7) NOT NULL,
CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED
(
[EmployeeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
and data Sample
EmployeeId EmployeeName EmployeeAge BirthDate
1 micheel 33 1985-01-10 00:00:00.0000000
2 elias 28 1990-02-25 00:00:00.0000000
4 adel 22 1995-12-12 00:00:00.0000000
5 gorg 38 1980-12-01 00:00:00.0000000
Actually I need to copy data of EmployeeId number 4 to New record Number 6
and different name as mariam so that record number 6 will be as following
6 mariam 22 1995-12-12 00:00:00.0000000
I work on sql server 2012 visual studio 2015 and i use c# language and i using ado.net technique
so that how to copy exist row to new row but change only will be in two fields
EmployeeId and EmployeeName
thanks
Continue reading...