Question Locked

Ms Sql sever 2005

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

MS sql database table tmp contain following
fields

ModifiedON_A datetime
CreatedOn_A datetime
CreatedBy_A datetime

ModifiedON_B datetime
CreatedOn_B datetime
CreatedBy_B datetime

if the ModifiedON_A date is null then the CreatedOn_A date needs to be checked to see if it meets the timeframe. If CreatedOn_A date is used then the CreatedBy_A value should be used for the ModifiedBy field. If these are all NULL then you use the same process using the ModifiedON_B fields.

thanks plz. reply me soon
in very much hurry !!!

2 replies

by tony hopkinson

as result
if you want to select a result from the table tmp use a case statement

select case when ModifiedON_A then CreatedOn_A end
from tmp

if you just want to do some logic

Declare @ModA date time
select @ModA = ModifiedON_A from tmp
if @ModA is null
begin
...
end

HTHs

This discussion is closed to new replies.