update column after certain time

%3CLINGO-SUB%20id%3D%22lingo-sub-1091156%22%20slang%3D%22en-US%22%3Eupdate%20column%20after%20certain%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1091156%22%20slang%3D%22en-US%22%3E%3CP%3EGreeting%20everyone%3C%2FP%3E%3CP%3Ei'm%20new%20here%20and%20i'm%20looking%20for%20answer%20for%20my%20question%3CBR%20%2F%3Emy%20idea%20is%20change%20value%20of%20row%20after%20certain%20time%20only%20once%3CBR%20%2F%3Ei%20have%20column%20in%20my%20table%20content%20number%20which%20considered%20as%20minutes%3C%2FP%3E%3CP%3Eif%20there's%20number%20on%20that%26nbsp%3Bcolumn%20mean%20this%20row%20will%20be%20update%20after%20minutes%20on%20that%26nbsp%3Bcolumn%3C%2FP%3E%3CP%3Eand%26nbsp%3Bif%20there's%20no%20number%20on%26nbsp%3Bthat%26nbsp%3Bcolumn%20there's%20will%20be%20no%20change%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20update%20will%20be%20only%20once%20on%20that%20row%20which%26nbsp%3Bcontent%20number%20(minutes)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehow%20can%20i%20do%20that%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei'm%20using%20that%20for%20my%20c%23%20project%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1138754%22%20slang%3D%22en-US%22%3ERe%3A%20update%20column%20after%20certain%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1138754%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F106887%22%20target%3D%22_blank%22%3E%40Mohammad%20Ahammad%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20the%20SQL%20script%20below%20may%20be%20fit%20your%20expectation.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3EIF%20exists%20(%20select%20r_number%20from%20orders%20where%20r_number%20is%20not%20null%20and%20processed_flag%20%3D%20'N')%0A%20%20Update%20orders%20set%20col1%20%3D%20xxx%0A%20%20Where%20r_number%20is%20not%20null%0A%20%20And%20processed_flag%20%3D%20'N'%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EYou%20may%20change%20the%20if%20clause%20with%20C%23%20syntax%20instead%20if%20you%20want.%20Hope%20it%20is%20useful%20for%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ESten%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Greeting everyone

i'm new here and i'm looking for answer for my question
my idea is change value of row after certain time only once
i have column in my table content number which considered as minutes

if there's number on that column mean this row will be update after minutes on that column

and if there's no number on that column there's will be no change 

the update will be only once on that row which content number (minutes)

 

how can i do that?

 

i'm using that for my c# project

1 Reply

Hi @Mohammad Ahammad ,

 

I think the SQL script below may be fit your expectation.

IF exists ( select r_number from orders where r_number is not null and processed_flag = 'N')
  Update orders set col1 = xxx
  Where r_number is not null
  And processed_flag = 'N'

You may change the if clause with C# syntax instead if you want. Hope it is useful for you.

 

Regards,

Sten