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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 First Record Problem???

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
Go to Top of Page

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 visible
Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

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_hr2

DECLARE @emp_id int
DECLARE @date1 datetime
DECLARE @date2 datetime

DECLARE CurEmp CURSOR
FOR Select emp_id from tbl_employee where emp_status = 1 order by emp_id
OPEN CurEmp

SET @date1 = getdate()
SET @date2 = dateadd(month,1,getdate())

FETCH NEXT FROM CurEmp INTO @emp_id

WHILE @@FETCH_STATUS = 0
BEGIN
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_id
END

CLOSE CurEmp
DEALLOCATE CurEmp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-17 : 04:46:45
Read this and post accordingly
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -