Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

can following query be used to find inserted update records.

$
0
0

hi,

i am using query1) to insert data query2) to update the record

query1)

INSERT INTO [t1]
           ( id

            ,createddatetime
           ,updateddatetime)
     VALUES
           (1
           ,GETDATE()
           ,GETDATE()) 

query2)

update t1 set updatedatetime=getdate() where id=@t1

--------------------------------------------


please tel me will two date cols get same time , that is, will i be able to 

write following to find inserted/updated rows

if exists(select * from t1 where createddt1=updateddt2)

begin 

select 'inserted'

end 

else

begin 

select 'updated'

end

yours sincerely


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>