I want to insert the current time automatically with the inserted date in datetime column. by default it inserts 00:00:00
I created the trigger
Create trigger tr_tm on emp
after insert,update
as
declare @tme time
set @tme=(select CONVERT(varchar(7),start_date,108) from emp)
update emp
set @tme=convert(varchar(8),getdate(),108)
where @tme='00:00:00'
go
but it shows error:
Msg 512, Level 16, State 1, Procedure tr_te, Line 15 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.
how it is possible??
Thanks in advance..