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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Send Email

Author  Topic 

papershop
Starting Member

27 Posts

Posted - 2012-02-14 : 21:35:39
Dear All i have a query like this

declare @partno varchar(10), @stok int, @part varchar(10)
declare @pesan varchar(100)


declare stok_cursor cursor for
select distinct partno, laststock from masterpart where laststock < minimumstock

open stok_cursor
fetch from stok_cursor into @partno, @stok
while @@fetch_status = 0
begin

EXEC msdb.dbo.sp_send_dbmail @profile_name='MMS Mail',
@recipients='Gatot.NurKholiq@gmail.com',
@copy_recipients='Galih.saputro@gmail.com',
@subject='Stok Asset MMS',
@body= 'Part NO :'+ @partno + 'Is Out Of Stock'
fetch next from stok_cursor into @partno, @stok
end

close stok_cursor
deallocate stok_cursor


i want the email result in the body is
Part No : 1 is out of stok...
but now the query is error can some one fix my query so i have the email result just like i want


@papershop

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-02-14 : 22:51:41
What is the error? What's the data type of partno in masterpart?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -