Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
prompratan
Starting Member
30 Posts |
Posted - 2005-10-17 : 04:32:10
|
First Record have 17 nov 2005 but any record have not 17 nov 2005.Why first record 17 nov 2005?thank you for all answer.code : result :  |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-10-17 : 04:36:52
|
| Sorry, can't see your pictures because the image link is to a file on your C: drive!Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-17 : 04:37:48
|
quote: Originally posted by prompratan First Record have 17 nov 2005 but any record have not 17 nov 2005.Why first record 17 nov 2005?thank you for all answer.code : result : 
The pictures are not visiblePost some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
prompratan
Starting Member
30 Posts |
Posted - 2005-10-17 : 04:45:33
|
| I am sorry. I don't know.First Record have 17 nov 2005 but any record have not 17 nov 2005.Why first record 17 nov 2005?thank you for all answer.Code : USE db_hr2DECLARE @emp_id intDECLARE @date1 datetimeDECLARE @date2 datetimeDECLARE CurEmp CURSORFOR Select emp_id from tbl_employee where emp_status = 1 order by emp_idOPEN CurEmpSET @date1 = getdate()SET @date2 = dateadd(month,1,getdate())FETCH NEXT FROM CurEmp INTO @emp_idWHILE @@FETCH_STATUS = 0BEGIN WHILE @date1 <= @date2 BEGIN Insert Into tbl_time(Time_EmpID,Time_Date) Values (@emp_id,@date1) SET @date1 = dateadd(day,1,@date1) END SET @date1 = getdate() FETCH NEXT FROM CurEmp INTO @emp_idENDCLOSE CurEmpDEALLOCATE CurEmp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|