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
 General SQL Server Forums
 New to SQL Server Programming
 to dates and from dates

Author  Topic 

kshitizgp
Starting Member

31 Posts

Posted - 2012-01-01 : 11:37:19
guyz i hardly have knwledge abt stored proc and i need help . plss

i designing a form which would give me the report of employee work summary ..

i am using (TO DATE ) AND from date using telerik so that employee when he selects the month ,he should get the summary of his work .

how to use to date and from date in work date using if loop

can u teme the exact thing ..
am thking like
if(work_date = start_Date and end_date>=work_date)
begin

select work_date as date , work_hours as Hours from employee where emp_id = @ emp_id and dep_id =@de_id

else ..what? plese guide me

please stored procedures are fking my brians

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-01 : 11:48:30
Perhaps better to use something like this?

select
work_date as date,
work_hours as Hours
from
employee
where
emp_id = @emp_id
and dep_id = @de_id
and work_date between start_date and end_date;
Go to Top of Page

whatamouth
Starting Member

16 Posts

Posted - 2012-01-02 : 04:51:13
-- this will get the total no. of hours worked of certain emp_id during the date provided

create procedure sproc_get_work_summary
(@start_date smalldatetime, @end_date smalldatetime, @emp_id varchar(10))

as
begin

select
SUM(work_hour)
from
employee
where
emp_id =@emp_id
and work_date between @start_date and @end_date

end


--hope it helps

Neil Matias
neilmatias@yahoo.com
Go to Top of Page
   

- Advertisement -