C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Uses of datediff and >= in stored procedure


Posted Date: 13 Aug 2008    Resource Type: Code Snippets    Category: C# Syntax
Author: Sadhana SinghMember Level: Gold    
Rating: Points: 10



This is the sample code snippets will give uses of datediff and >= in stored procedure.


declare @jobid varchar(50)
declare @empid varchar(50)
declare @diffyear varchar(50)
set @jobid='0'
set @empid='0'

select @jobid=job_id from emp_profile where job_id=@job_id
select @empid=@emp_email_id from emp_profile where emp_email_id=@emp_email_id

select @diffyear= datediff(yy,@dob,@date_of_joining)


if @empid='0' and @jobid='0' and @diffyear>=22
begin

insert into emp_profile(job_id,emp_name,emp_desig,emp_contact_no,emp_email_id,date_of_joining,
marital_status,dob,sex,emp_address,city,state,country,zip_code)

values(@job_id,@emp_name,@emp_desig,@emp_contact_no,@emp_email_id,@date_of_joining,
@marital_status,@dob,@sex,@emp_address,@city,@state,@country,@zip_code)


return 11
end
else if @empid='0' and @jobid<>'0'
begin
return 22
end
else if @empid<>'0' and @jobid='0'

begin
return 33
end
else if @empid<>'0' and @jobid<>'0'

begin
return 44
end
else if @diffyear<22
begin
return 55
end




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Datediff  .  C# datediff  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Two buttons on home page
Previous Resource: Graph in Crystal Report
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use