Hi
How to insert this situation using Cursor loop
when i enter from date and to date . I need with in the date data inserted using cursor.
How will do this
My From date : 30 Dec 2016
My To Date : 24 jan 2017
tables this
create table employees1
(
Id int primary key identity(1,1),
Ename varchar(40),
Empno int,
empcreateddate datetime
)
create table employees2
(
Id int primary key identity(1,1),
Ename varchar(40),
Empno int,
empcreateddate datetime
)
insert into employees2 values('John',100,getdate()),('Elin',101,getdate()-1),('Revghy',102,getdate()),
('Rufen',103,getdate()),('Fedrick',104,getdate()-2),('Adam',105,getdate()),('Gilic',106,getdate()-1),
('Fernadas',107,getdate()),('Fernadas sr',107,getdate()-23),('jernadas',107,getdate()-24),
('yjernadas',107,getdate()-25)
--truncate table employees2
select * from employees2 order by empcreateddate desc
--I Need to insert this table employees1 using cursor looping from date to date
records only. But from this table employees2
-- here My employees1 No datas right row. so
-- I want how to insert records based on created date using cursor
--for ex: i need first 24 jan 2017 etc ... 30 Dec 2016
-- How to use cursor looping for insert
Mark as Answer if its helpful to you
Kumaraspcode2009@gmail.com