Hello,
When I tried out your script under SQL 2005, I got the following errors:-
Msg 8152, Level 16, State 2, Procedure sysmail_help_profile_sp, Line 20
String or binary data would be truncated.
(3 row(s) affected)
Msg 8152, Level 16, State 2, Procedure sysmail_help_account_sp, Line 20
String or binary data would be truncated.
(0 row(s) affected)
I updated the table column definitions as below, and now it runs fine.
Regards,
John Marsh
CREATE TABLE #temp01
(
profile_id INT,
[name] sysname,
description NVARCHAR(256)
)
INSERT INTO #temp01
EXECUTE msdb.dbo.sysmail_help_profile_sp ;
CREATE TABLE #temp02
(
profile_id INT,
profile_name sysname,
account_id INT,
account_name sysname,
seq int
)
INSERT INTO #temp02
EXECUTE msdb.dbo.sysmail_help_profileaccount_sp ;
CREATE TABLE #temp03
(
account_id INT,
[name] sysname,
[description] NVARCHAR(256),
email_address NVARCHAR(128),
display_name NVARCHAR(128),
replyto_address NVARCHAR(128),
servertype sysname,
servername sysname,
port INT,
username NVARCHAR(128),
use_default_credentials bit,
enable_ssl bit
)
INSERT INTO #temp03
EXECUTE msdb.dbo.sysmail_help_account_sp ;
SELECT a.name,
b.account_name,
c.description,
c.email_address,
c.display_name,
c.replyto_address,
c.servertype,
c.servername,
c.port,
c.username,
c.use_default_credentials,
c.enable_ssl
FROM [#temp01] AS a
INNER JOIN [#temp02] AS b ON a.profile_id = b.[profile_id]
INNER JOIN [#temp03] AS c ON b.account_id = c.account_id
DROP TABLE #temp01
DROP TABLE #temp02
DROP TABLE [#temp03]
www.sql.lu
SQL Server Luxembourg User Group