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.
Author |
Topic |
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2014-04-21 : 20:16:27
|
Hi All,I have a table eg:ID Datt Amount210 01/2012 400210 02/2012 500250 03/2012 600280 04/2012 800290 05/2013 1200320 01/2013 200::982 02/2015 652if my SP date input as 01/Apr/2012. Mean i want the rest of the value turn to be 0eg:ID Datt Amount210 01/2012 0210 02/2012 0250 03/2012 0280 04/2012 800290 05/2013 0320 01/2013 200::982 02/2015 652Please advise.Thank you.Regards,Micheale |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2014-04-22 : 06:37:56
|
select ID, Datt ,Amount = case when Datt >= @d then Amount else 0 endfrom tblif Datt is really mm/yyyy then useconvert(datetime,'01/'+Datt,103) in place of Datt in the case statement.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|