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 2000 Forums
 SQL Server Development (2000)
 Store Procedure -help

Author  Topic 

amy
Starting Member

30 Posts

Posted - 2002-06-18 : 15:56:48
Hi,
I try to created the sp but I got this error and don't know why, so I need your help to tell me what did I do wrong and my syntax is correct or not
errr: Incorrect syntax near '@recipients'.

Thanks
=========
create procedure Sp_Mail
as
@recipients = 'amy@css.com',
@message ='test',
@query = 'Select CustomerID From Customers',
@subject = 'testsub',
@dbuse = 'Northwind'


izaltsman
A custom title

1139 Posts

Posted - 2002-06-18 : 16:06:38
Umm... Looking at all the variables it appears that you are trying to pass parameters to xp_sendmail... Except you forgot the line that actually mentions what proc you are trying to call!

create procedure Sp_Mail
as
EXEC master.dbo.xp_sendmail
@recipients = 'amy@css.com',
@message ='test',
@query = 'Select CustomerID From Customers',
@subject = 'testsub',
@dbuse = 'Northwind'




Edited by - izaltsman on 06/18/2002 16:16:50
Go to Top of Page

monkeybite
Posting Yak Master

152 Posts

Posted - 2002-06-18 : 16:11:04
If you're trying to create a SPROC with parameters, it looks like the parameters are declared after the AS keyword, and no data type was specified for them ...


CREATE PROCEDURE [sp_mail]

@recipients varchar(30) = 'amy@css.com',
@message varchar(30) = 'test',
@query varchar(50) = 'Select CustomerID From Customers',
@subject varchar(30) = 'testsub',
@dbuse varchar(30) = 'Northwind'

AS
...





Edited by - monkeybite on 06/18/2002 16:12:12
Go to Top of Page

amy
Starting Member

30 Posts

Posted - 2002-06-18 : 16:34:46
Yes it is working now
Many Many thanks

Go to Top of Page
   

- Advertisement -