Showing posts with label procedures. Show all posts
Showing posts with label procedures. Show all posts

Friday, March 30, 2012

Problem returning two values from stored procedures

Hi, i am trying to return two values from SQL 2000 using a single stored procedure. The stored working fine in Query Analyser and returns the two values and two grids in the results window.

My problem is that when i execute the stored procedure using ADO.Net the dataset only has one of the values. e.g TId : 2, where it should read 'TId' : 2, 'ConfigPath': 'C:\blah'

Please could anyone shed ligth on this problem?

here the code for the stored procedure:

CREATE PROCEDURE dbo.GetTillInfo
(
@.TillIdR varchar(50),
@.Password varchar(50)
)
AS

declare @.TillId int
declare @.configpath varchar(150)

IF Exists (SELECT Id FROM Tills WHERE TillRef=@.TillId and TillPassword=@.Password)
BEGIN

set @.TillIdR = (SELECT Id FROM Tills WHERE TillRef=@.TillId and TillPassword=@.Password)
select @.TillIdR as 'TId'

set @.configpath = (SELECT configpath from customer,tills where
tills.customerid = customer.id and tills.id = @.login)
select @.configpath as 'ConfigPath'
END
ELSE
BEGIN
set @.TillIdR = 0
select @.TillIdR as 'TId'
set @.configpath =''
select @.configpath as 'ConfigPath'
END
GOOff the top of my head, the two results may be returned but in two tables as you are performing two selects.

To get round this you could change your select query to return the two values like:-


IF ...
set @.TillIdR = (SELECT Id FROM Tills WHERE TillRef=@.TillId and TillPassword=@.Password)
set @.configpath = (SELECT configpath from customer,tills where
tills.customerid = customer.id and tills.id = @.login)

select @.TillIdR as 'TId', @.configpath as 'ConfigPath'
END
ELSE
BEGIN
set @.TillIdR = 0
set @.configpath =''
select @.TillIdR as 'TId', @.configpath as 'ConfigPath'
END
GO

This is off the top of my head at work - you may have to play with the stored proc.

Rob

Tuesday, March 20, 2012

Problem on scripting stored procedures

I have tried to script all of stored procedures in one database on SQL server
2005 then it seems like get stacked. To script one stored procedure has no
problem however when try to script all stored procedures SSMS never respond.
I have never experience this problem on SQL server 2000.
Any help?
M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> I have tried to script all of stored procedures in one database on SQL
> server 2005 then it seems like get stacked. To script one stored
> procedure has no problem however when try to script all stored
> procedures SSMS never respond.
> I have never experience this problem on SQL server 2000.
> Any help?
How many procedures are there in the database? There were performance
issues during the beta, but it appears to behave decently now.
One possibility is blocking, if someone has submitted:
BEGIN TRANSACTION
go
CREATE PROCEDURE ...
and never committed the transaction. You can use sp_who to determine if
you have any blocking in the database. If there is a non-zero value in
the Blk column, in means that the spid in Blk blocks the spid on that
line.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||There are 193 stored procedures and same process on SQL 2000 ends less than
30 second. There is no other user using SQL 2005 except myself. (Because this
SQL 2005 is used as application development purpose.)
When script one stored procedure SSMS promptly responded and showed dialog
where to save however when select all stored procedures it did not show the
dialog more than 10 minits.
Performance monitor showed 100% processor time during being stalled.
"Erland Sommarskog" wrote:

> M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> How many procedures are there in the database? There were performance
> issues during the beta, but it appears to behave decently now.
> One possibility is blocking, if someone has submitted:
> BEGIN TRANSACTION
> go
> CREATE PROCEDURE ...
> and never committed the transaction. You can use sp_who to determine if
> you have any blocking in the database. If there is a non-zero value in
> the Blk column, in means that the spid in Blk blocks the spid on that
> line.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>
|||M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> There are 193 stored procedures
That's not an extraordiary lot.

> There is no other user using SQL 2005 except myself.
That does not preclude blocking, if that is what you were thinking.

> When script one stored procedure SSMS promptly responded and showed
> dialog where to save however when select all stored procedures it did
> not show the dialog more than 10 minits.
> Performance monitor showed 100% processor time during being stalled.
Hm, is Mgmt Studio and SQL Server on the same machine? How much memory
is there in the box? How much memory does SQL Server actually have?
What I have noticed with SQL 2005 is that if it falls down 30-35 MB in
memory, the simplest queries can take over 10 seconds.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||SQL 2005 installed in Netfinity 5000 with 896MB RAM (P3 500M HZ) + Windows
2003 Server. SSMS and SQL 2005 reside on same machine.
Before upgrade to SQL 2005, SQL 2000 run on same machine did not have any
problem. Even SQL 2000 + Windows XP installed on notebook (Think pad 512MB
RAM) + Visual Stuido 2005 run on same time does not have any problem to
perform this process.
"Erland Sommarskog" wrote:

> M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> That's not an extraordiary lot.
>
> That does not preclude blocking, if that is what you were thinking.
>
> Hm, is Mgmt Studio and SQL Server on the same machine? How much memory
> is there in the box? How much memory does SQL Server actually have?
> What I have noticed with SQL 2005 is that if it falls down 30-35 MB in
> memory, the simplest queries can take over 10 seconds.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>
|||I don't know how you can get 896MB of memory, I suspect it is really 512MB.
But in any case you are not meeting the minimum hardware requirements on CPU
for SQL2005 let alone the recommended. As such I would expect it to be
somewhat slow.
http://www.microsoft.com/sql/editions/developer/sysreqs.mspx
Andrew J. Kelly SQL MVP
"M. Matsuda" <MMatsuda@.discussions.microsoft.com> wrote in message
news:A207A819-2286-4552-9EE4-3F4918687303@.microsoft.com...[vbcol=seagreen]
> SQL 2005 installed in Netfinity 5000 with 896MB RAM (P3 500M HZ) +
> Windows
> 2003 Server. SSMS and SQL 2005 reside on same machine.
> Before upgrade to SQL 2005, SQL 2000 run on same machine did not have any
> problem. Even SQL 2000 + Windows XP installed on notebook (Think pad 512MB
> RAM) + Visual Stuido 2005 run on same time does not have any problem to
> perform this process.
> "Erland Sommarskog" wrote:
|||Sounds like you are blaming that hardware has not meet minimum requirement of
SQL 2005. However this system has PIII 600MHZ 896MB RAM (Windows 2003
recognize 896MB). It meets minimum requirement of 32bit SQL 2005.
Would you tell me what a expected time to finish this process on miminum
hardware requirement?
Thanks in advance
"Andrew J. Kelly" wrote:

> I don't know how you can get 896MB of memory, I suspect it is really 512MB.
> But in any case you are not meeting the minimum hardware requirements on CPU
> for SQL2005 let alone the recommended. As such I would expect it to be
> somewhat slow.
> http://www.microsoft.com/sql/editions/developer/sysreqs.mspx
> --
> Andrew J. Kelly SQL MVP
> "M. Matsuda" <MMatsuda@.discussions.microsoft.com> wrote in message
> news:A207A819-2286-4552-9EE4-3F4918687303@.microsoft.com...
>
>
|||M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> SQL 2005 installed in Netfinity 5000 with 896MB RAM (P3 500M HZ) +
> Windows 2003 Server. SSMS and SQL 2005 reside on same machine. Before
> upgrade to SQL 2005, SQL 2000 run on same machine did not have any
> problem. Even SQL 2000 + Windows XP installed on notebook (Think pad
> 512MB RAM) + Visual Stuido 2005 run on same time does not have any
> problem to perform this process.
It is not very impressing hardware. And, yes, this problem with SQL Server
being very slow when it's low on memory is much more apparent with SQL 2005
than SQL 2000.
Did you use Task Manager to see how much memory SQL Server has when
performing the scripting operation?
If you have other processes running, for instance a web browser, try closing
these and see if it helps.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||Our tight budget won't allow me to upgrade fancy hardware as you may have and
still need to deal with limited resources and so do my small business clients
too.
I had a chance to test same process on IBM XS235 Xeon 3.06GHZ with 1.5GB RAM
relatively enough spec for SQL 2005 however it still took 7-8 minutes to get
response from SSMS. If this is ideal time to finish this process, I may need
to stick SQL 2000 for a while and recommend stay with SQL 2000 to my clients
for time being.
Thank you for your assistance.
"Erland Sommarskog" wrote:

> M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> It is not very impressing hardware. And, yes, this problem with SQL Server
> being very slow when it's low on memory is much more apparent with SQL 2005
> than SQL 2000.
> Did you use Task Manager to see how much memory SQL Server has when
> performing the scripting operation?
> If you have other processes running, for instance a web browser, try closing
> these and see if it helps.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>
|||M. Matsuda (MMatsuda@.discussions.microsoft.com) writes:
> Our tight budget won't allow me to upgrade fancy hardware as you may
> have and still need to deal with limited resources and so do my small
> business clients too.
Fancy and fancy. A 500 Mhz machine a certainly to reqard as an antiquity
today.

> I had a chance to test same process on IBM XS235 Xeon 3.06GHZ with 1.5GB
> RAM relatively enough spec for SQL 2005 however it still took 7-8
> minutes to get response from SSMS. If this is ideal time to finish this
> process, I may need to stick SQL 2000 for a while and recommend stay
> with SQL 2000 to my clients for time being.
I tried the exercise at home on a Pentium4 2.8 GHz with hyperthreading
and 1.5 GB of memory. I selected 275 procedures, and took about the time you
mentioned to script them. I noticed that SQL Server was eating a lot
of memory, around 440 MB, as well as CPU. For some reason that I don't
understand, Windows Explorer was also consuming CPU.
In this experiment, I selected the procedures from the Summary view.
The next thing I did was to use the scripting wizard. Right-click the
database node in Object Explorer and select Tasks->Generate Scripts.
It took about a minute for me to make the selection. (This database
has over 4000 thousand procedures, so I could not use Select all.)
But once started, the wizard completed within a minute. It may be
because SQL Server now had all it neded in memory. I need to play
with this a little more.
I agree with you that the performance is not satisfactory.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Problem on creating stored procedure

The code is as below:

--Drop procedures if they exsit
if exists (SELECT * FROM master.dbo.sysobjects WHERE id = object_id(N'[dbo].[sp_PagedItems]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_PagedItems]
GO

if exists (SELECT * FROM master.dbo.sysobjects WHERE id = object_id(N'[dbo].[sp_PagedItemsByTime]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_PagedItemsByTime]
GO

if exists (SELECT * FROM master.dbo.sysobjects WHERE id = object_id(N'[dbo].[sp_selectedEventMessage]') AND OBJECTPROPERTY(id,N'IsProcedure')=1)
drop procedure [dbo].[sp_selectedEventMessage]
GO

--Definitions of procedures
USE LanDeskDB
GO

CREATE PROCEDURE sp_PagedItems
(
@.QueryVARCHAR(1000),
@.Pageint,
@.RecsPerPageint,
@.startDateVARCHAR(100),
@.endDateVARCHAR(100),
@.allTimeint,
@.flagint
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @.SQL VARCHAR(2000)
DECLARE @.Order VARCHAR(200)
DECLARE @.TotalBIGINT

CREATE TABLE #TempTable
(
TempTableID BIGINT NOT NULL PRIMARY KEY IDENTITY(1,1),
EventLogID BIGINT ,
EventDateTime datetime,
MachineID INT ,
TypeID INT ,
SessionID INT ,
SourceID INT ,
MessageID BIGINT ,
UserID INT,
CategoryNumber INT,
EventID INT
)
IF (@.flag = 1)
BEGIN
SET @.Order = 'ORDER BY EventDateTime'
END
IF (@.flag = 2)
BEGIN
SET @.Order = 'ORDER BY SessionID,EventDateTime'
END
IF (@.flag = 3)
BEGIN
SET @.Order = 'ORDER BY TypeID,EventDateTime'
END
IF (@.flag = 4)
BEGIN
SET @.Order = 'ORDER BY CategoryNumber,EventDateTime'
END
IF(@.allTime <> 1)
BEGIN
IF(LEN(@.Query)>1)
BEGIN
SET @.Query = @.Query+'AND EventDateTime>='''+@.startDate+''' AND EventDateTime <= '''+@.endDate+''''
END
ELSE
BEGIN
SET @.Query = 'WHERE EventDateTime>='''+@.startDate+''' AND EventDateTime <= '''+@.endDate+''''
END
END
SET @.SQL=
'INSERT INTO #TempTable (EventLogID,EventDateTime,MachineID,TypeID,SessionID,SourceID,MessageID,UserID,CategoryNumber,EventID)'+
'SELECT EventlogID,EventDateTime,MachineID,TypeID,SessionID,SourceID,MessageID,UserID,CategoryNumber,EventID FROM EventLog '+
@.Query+' '+@.Order
EXEC (@.SQL)

CREATE TABLE #TempTableTwo
(
TempTableTwoID BIGINT NOT NULL PRIMARY KEY IDENTITY(1,1),
TempTableID BIGINT,
EventLogID BIGINT ,
EventDateTime datetime,
MachineID INT ,
TypeID INT ,
SessionID INT ,
SourceID INT ,
MessageID BIGINT ,
UserID INT,
CategoryNumber INT,
EventID INT,
)

DECLARE @.FirstRec int, @.LastRec int
SELECT @.FirstRec = (@.Page - 1) * @.RecsPerPage
SELECT @.LastRec = @.Page * @.RecsPerPage+1

INSERT #TempTableTwo

SELECT * FROM #TempTable T
WHERE T.TempTableID >@.FirstRec AND T.TempTableID < @.LastRec

SELECT TempT.EventLogID AS EventLogID,TempT.EventDateTime AS EventDateTime,
Ma.MachineName AS MachineName,Se.SessionName AS SessionName,Ty.TypeName AS TypeName,
TempT.CategoryNumber AS CategoryNumber,Us.UserName AS UserName,So.SourceName AS SourceName,
TempT.EventID AS EventID
FROM #TempTableTwo TempT,Machines Ma,Types Ty,Sessions Se,Sources So,Users Us
WHERE TempT.MachineID = Ma.MachineID AND TempT.TypeID = Ty.TypeID AND TempT.SessionID = Se.SessionID
AND TempT.SourceID = So.SourceID AND TempT.UserID = Us.UserID

SELECT COUNT(*) FROM #TempTable

DROP TABLE #TempTable
DROP TABLE #TempTableTwo
SET NOCOUNT OFF
END
GO

CREATE PROCEDURE sp_PagedItemsByTime
(
@.QueryVARCHAR(1000),
@.Page int,
@.RecsPerPage int,
@.startDateVARCHAR(100),
@.endDateVARCHAR(100),
@.allTime int
)
AS
BEGIN
EXEC sp_PagedItems @.Query,@.Page,@.RecsPerPage,@.startDate,@.endDate,@.allTime,1
END
GO

CREATE PROCEDURE sp_selectedEventMessage
(
@.EventLogID int
)
AS

BEGIN

SELECT Ma.MachineName,Ev.EventDateTime,Se.SessionName,Ty.TypeName,So.SourceName,Me.MessageDescription
FROM EventLog Ev,Sessions Se,Types Ty,Sources So,Messages Me,Machines Ma
WHERE Ev.EventLogID = @.EventLogID AND Ev.SessionID = Se.SessionID AND Ma.MachineID = Ev.MachineID
AND Ev.TypeID = Ty.TypeID AND Ev.SourceID = So.SourceID AND Ev.MessageID = Me.MessageID

END

GO

I got the error messge as
Server: Msg 2714, Level 16, State 5, Procedure sp_PagedItems, Line 107
There is already an object named 'sp_PagedItems' in the database.
Server: Msg 2714, Level 16, State 5, Procedure sp_PagedItemsByTime, Line 13
There is already an object named 'sp_PagedItemsByTime' in the database.
Server: Msg 2714, Level 16, State 5, Procedure sp_selectedEventMessage, Line 12
There is already an object named 'sp_selectedEventMessage' in the database.

But I already delete those procedures before I create them. Could anyone give some suggestion?Change this master.dbo.sysobjects to LanDeskDB.dbo.sysobjects in your 3 EXISTS statements in the top of your code and it will work fine for you.

Terri|||Thank you very much. It works now.

Problem on ## table

Hi
I have a stored procedure , wherein i create a ## table and get values in
it, i have 3 more procedures which i call from the original procedure which
use the ##table.
When i execute the stored procedure for first time i get the desired
results. when i re-run it again it says the ## table exists . so when i
delete the ## table from tempdb and then re-run it again it works.
Is there a way to delete this ## table right in the begining of execution of
the stored procedure. when i try drop table ## it says the table does not
exists for the first time of execution, if i put the code if (exist whis
table = ##) even this does not work, if i say delte from tempdb.dbo.## even
this does not work
any suggestionTry,
if object_id('tempdb..##t') is not null
drop table ##t
...
AMB
"Rodger" wrote:

> Hi
> I have a stored procedure , wherein i create a ## table and get values in
> it, i have 3 more procedures which i call from the original procedure whic
h
> use the ##table.
> When i execute the stored procedure for first time i get the desired
> results. when i re-run it again it says the ## table exists . so when i
> delete the ## table from tempdb and then re-run it again it works.
> Is there a way to delete this ## table right in the begining of execution
of
> the stored procedure. when i try drop table ## it says the table does not
> exists for the first time of execution, if i put the code if (exist whis
> table = ##) even this does not work, if i say delte from tempdb.dbo.## eve
n
> this does not work
> any suggestion|||It sounds like you should use a local temp table rather than a global
temp table. Specify #tablename rather than ##tablename. Put the DROP
statement at the END of your code that uses the table so that it cleans
up there rather than at the beginning.
David Portas
SQL Server MVP
--|||1) If the stored Procedure is not running multiple instances concurrently,
(i,e., two processes calling it at the same time or overlappiing) Then why
don't you delete it at the end, when the stored Proc is done?
Drop Table ##TableName
or
2) Make it a permanent table and just delete all therecords in it a tteh
beginning (And maybe also at the end) of the stored proc.
or, if the SPs DO run concurrently, you could
3) change the data structure of the temp table so that records being
inserted can be identified as to which instance of the SP they were created
from, (Add an "Instance" or "RunNo" Column) and then modify all other
statements in the SP to affect only those records,
"Rodger" wrote:

> Hi
> I have a stored procedure , wherein i create a ## table and get values in
> it, i have 3 more procedures which i call from the original procedure whic
h
> use the ##table.
> When i execute the stored procedure for first time i get the desired
> results. when i re-run it again it says the ## table exists . so when i
> delete the ## table from tempdb and then re-run it again it works.
> Is there a way to delete this ## table right in the begining of execution
of
> the stored procedure. when i try drop table ## it says the table does not
> exists for the first time of execution, if i put the code if (exist whis
> table = ##) even this does not work, if i say delte from tempdb.dbo.## eve
n
> this does not work
> any suggestion|||You might want to consider writing a single procedure that replaces
this chain of calls. I have found that temp tables can often be
replaced with VIEWs, derived tables or CTEs.
Programming with temp tables in SQL Server is usually a sign that the
programmer is mimicking a procedural file system model of data in which
each of a series of procedural steps is written to a temp table (aka
"Scratch tape") and processed sequentially.

Friday, March 9, 2012

Problem Jobs with send mails

hello people,
i have a stored procedure that send mails masive to users, this stored
procedures succesfully execute manually, but programming job for execute
this stored procedurre not send mail, but histoyr job its succesfully.
what its happening?Hi Jesus
You don't say how you are sending the emails, but if the procedure does not
raise an error and only returns an status code then you would need to check
this status code asnd raise your own error to make the step fail.
HTH
John
"Jesus Suarez" wrote:
> hello people,
> i have a stored procedure that send mails masive to users, this stored
> procedures succesfully execute manually, but programming job for execute
> this stored procedurre not send mail, but histoyr job its succesfully.
> what its happening?
>
>|||hello
send mail using xpsmtp, but i dont undertand you, the storede procedure not
error, only if execute this stored procedured using jobs
"John Bell" <jbellnewsposts@.hotmail.com> escribió en el mensaje
news:FA1FF0E8-207A-4D7D-9886-CA18B58CC286@.microsoft.com...
> Hi Jesus
> You don't say how you are sending the emails, but if the procedure does
> not
> raise an error and only returns an status code then you would need to
> check
> this status code asnd raise your own error to make the step fail.
> HTH
> John
> "Jesus Suarez" wrote:
>> hello people,
>> i have a stored procedure that send mails masive to users, this stored
>> procedures succesfully execute manually, but programming job for execute
>> this stored procedurre not send mail, but histoyr job its succesfully.
>> what its happening?
>>|||Did you specify an output file for the job step and check for messages in that output file?
According to http://sqldev.net/xp/xpsmtp.htm, any error from xp_smtp_sendmail should return a return
code, also accompanied by an error message.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jesus Suarez" <suarez.lopezjesus@.gmail.com> wrote in message
news:%230LivVP$GHA.4980@.TK2MSFTNGP04.phx.gbl...
> hello
> send mail using xpsmtp, but i dont undertand you, the storede procedure not error, only if execute
> this stored procedured using jobs
> "John Bell" <jbellnewsposts@.hotmail.com> escribió en el mensaje
> news:FA1FF0E8-207A-4D7D-9886-CA18B58CC286@.microsoft.com...
>> Hi Jesus
>> You don't say how you are sending the emails, but if the procedure does not
>> raise an error and only returns an status code then you would need to check
>> this status code asnd raise your own error to make the step fail.
>> HTH
>> John
>> "Jesus Suarez" wrote:
>> hello people,
>> i have a stored procedure that send mails masive to users, this stored
>> procedures succesfully execute manually, but programming job for execute
>> this stored procedurre not send mail, but histoyr job its succesfully.
>> what its happening?
>>
>|||Hi Jesus
xp_smtp_sendmail will return 1 if there is a problem, you may want to create
a test job that just sends a test email and selects the return code.
e.g.
DECLARE @.rc int
EXEC @.rc = xp_smtp_sendmail....
SELECT @.rc
Add a log file in the advanced tab of the step so that you have a copy of
the output from the step, this may give you some indication of any error. You
may also need to change the SQL Agent service account to be a domain account
if network access is an issue.
John
"Jesus Suarez" wrote:
> hello
> send mail using xpsmtp, but i dont undertand you, the storede procedure not
> error, only if execute this stored procedured using jobs
> "John Bell" <jbellnewsposts@.hotmail.com> escribió en el mensaje
> news:FA1FF0E8-207A-4D7D-9886-CA18B58CC286@.microsoft.com...
> > Hi Jesus
> >
> > You don't say how you are sending the emails, but if the procedure does
> > not
> > raise an error and only returns an status code then you would need to
> > check
> > this status code asnd raise your own error to make the step fail.
> >
> > HTH
> >
> > John
> >
> > "Jesus Suarez" wrote:
> >
> >> hello people,
> >>
> >> i have a stored procedure that send mails masive to users, this stored
> >> procedures succesfully execute manually, but programming job for execute
> >> this stored procedurre not send mail, but histoyr job its succesfully.
> >>
> >> what its happening?
> >>
> >>
> >>
>
>