Click here to Skip to main content
15,908,634 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all..

i need that if the updation on my table goes twice in a day than in historytable the record goes to update
but if the updation on my table in a day goes once than in history table the record goest insert.
Posted
Comments
[no name] 15-May-12 7:11am    
Data comparison is very easy. What have you tried so far? What are you having difficulty with?

 
Share this answer
 
Comments
Maciej Los 17-May-12 17:22pm    
Good answer, 5!
 
Share this answer
 
Comments
Maciej Los 17-May-12 17:23pm    
Good answer, 5!
Prasad_Kulkarni 23-May-12 3:35am    
Thank you Isomac!
IF EXISTS(SELECT 'x' FROM HistoryTable where [date]=@ModifiedDate and PrimaryKeyColumn=@PrimaryKeyValue)
begin
update HistoryTable set [date]= @ModifiedDate where PrimaryKeyColumn=@PrimaryKeyValue
end
else
begin
insert into HistoryTable ........
end
 
Share this answer
 
v2
Magic tables can help you. Try RND about Magic Tables.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900