declare @maxcount as varchar(10)
select @maxcount = count(id_number)from dbo.iqm_newemployees
select @maxcount
if @maxcount >= 3
Select @maxcount
DECLARE @ProductTotals TABLE
(
[id_number] [int] NOT NULL,
[employee_name] [varchar](51) NOT NULL,
[account_disabled] [bit] NOT NULL,
[startdate] [datetime] NULL,
[defaultlocation] [int] NULL
)
insert into @ProductTotals(id_number,employee_name,account_disabled,startdate,defaultlocation)
select id_number,employee_name,account_disabled,startdate,defaultlocation from dbo.iqm_newemployees
where status = 0
select * from @ProductTotals
EXEC msdb.dbo.sp_send_dbmail
@recipients='reddy@arjaywireless.com',
@body= 'select * from @producttotals',
@subject = 'new record inserted',
@profile_name = 'Arjayreddysemail'
else
select 'test'
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
@recipients='reddy@arjaywi
@query = 'select * from @producttotals',
@subject = 'new record inserted',
@profile_name = 'Arjayreddysemail'