Click here to Skip to main content
15,911,646 members
Home / Discussions / Database
   

Database

 
GeneralRe: sub query in create table command Pin
M. J. Jaya Chitra8-Nov-07 21:35
M. J. Jaya Chitra8-Nov-07 21:35 
QuestionWhy doesn't the ldb go away when the connection is closed? Pin
John Whitmire8-Nov-07 11:06
professionalJohn Whitmire8-Nov-07 11:06 
QuestionData Bank connection with OLE DB! Please Help! Pin
FreeEagle8-Nov-07 8:11
FreeEagle8-Nov-07 8:11 
Answercross-post Pin
led mike9-Nov-07 5:06
led mike9-Nov-07 5:06 
QuestionAccess 2003 INNER JOIN Error Pin
Brendan Vogt8-Nov-07 5:37
Brendan Vogt8-Nov-07 5:37 
AnswerRe: Access 2003 INNER JOIN Error Pin
pmarfleet8-Nov-07 9:27
pmarfleet8-Nov-07 9:27 
QuestionRe: Access 2003 INNER JOIN Error Pin
Brendan Vogt8-Nov-07 18:42
Brendan Vogt8-Nov-07 18:42 
Questionsp_send_dbmail as HTML Email Pin
solutionsville8-Nov-07 5:04
solutionsville8-Nov-07 5:04 
I took the books online sample and modified it with my data. When I run the query it sends the email, with the Header, and nothing else. The Table data never shows. Here is the code I used;

USE NMS_RT
DECLARE @tableHTML NVARCHAR(MAX) ;
SET @tableHTML =
N'<H1>MCP Alarms for previous 24 Hours</H1>' +
N'<table border="1>' +
N'<tr><th>Wayside_Name</th><th>ST</th><th>Alarm_Message</th>' +
N'<th>Error_Count</th><th>Error_Date</th><th>Alarm_State</th></tr>' +
CAST ( ( SELECT td = RT_MCP_Name, '',
td = RT_MCP_State, '',
td = RT_MCP_Alarm_Text, '',
td = COUNT(RT_MCP_Alarm_Text), '',
td = CONVERT(char(10), RT_MCP_Date_Time, 111), '',
td = RT_MCP_Bit_State, ''
FROM RT_MCP_Historic_Alarms
WHERE [RT_MCP_Date_Time] >= Convert(char(10), DateADD(DAY, -1, GETDATE()), 101) AND [RT_MCP_Date_Time] < Convert(char(10), GETDATE(), 101) and RT_MCP_Bit_State > 0
GROUP BY RT_MCP_Name, RT_MCP_State, RT_MCP_Alarm_Text, RT_MCP_Bit_State, CONVERT(char(10), RT_MCP_Date_Time, 111)
HAVING COUNT(RT_MCP_Alarm_Text) >= 10
ORDER BY CONVERT(char(10), RT_MCP_Date_Time, 111), COUNT(RT_MCP_Alarm_Text) DESC, RT_MCP_Name, RT_MCP_State, RT_MCP_Alarm_Text, RT_MCP_Bit_State
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>' ;

EXEC msdb.dbo.sp_send_dbmail
@recipients='user@anywhere.com',
@subject = 'MCP Alarms for Previous 24 Hours',
@body = @tableHTML,
@body_format = 'HTML',
@profile_name = 'test';

Any suggestions?

AnswerRe: sp_send_dbmail as HTML Email Pin
solutionsville9-Nov-07 3:18
solutionsville9-Nov-07 3:18 
QuestionCopy Database Error Pin
Xmen Real 8-Nov-07 1:49
professional Xmen Real 8-Nov-07 1:49 
AnswerRe: Copy Database Error Pin
pmarfleet8-Nov-07 2:01
pmarfleet8-Nov-07 2:01 
GeneralRe: Copy Database Error Pin
Xmen Real 8-Nov-07 2:47
professional Xmen Real 8-Nov-07 2:47 
GeneralRe: Copy Database Error Pin
pmarfleet8-Nov-07 2:51
pmarfleet8-Nov-07 2:51 
GeneralRe: Copy Database Error Pin
Xmen Real 8-Nov-07 2:58
professional Xmen Real 8-Nov-07 2:58 
Questionquery in oracle Pin
gauthee8-Nov-07 0:38
gauthee8-Nov-07 0:38 
AnswerRe: query in oracle Pin
pmarfleet8-Nov-07 1:50
pmarfleet8-Nov-07 1:50 
QuestionProblem with a InsertStored Procedure for Vb.net Pin
Vimalsoft(Pty) Ltd7-Nov-07 22:05
professionalVimalsoft(Pty) Ltd7-Nov-07 22:05 
AnswerRe: Problem with a InsertStored Procedure for Vb.net Pin
Paddy Boyd8-Nov-07 0:25
Paddy Boyd8-Nov-07 0:25 
GeneralRe: Problem with a InsertStored Procedure for Vb.net Pin
Vimalsoft(Pty) Ltd8-Nov-07 0:54
professionalVimalsoft(Pty) Ltd8-Nov-07 0:54 
QuestionSql Server 2005 Devloper Edition Pin
Thaer Hamael7-Nov-07 21:43
Thaer Hamael7-Nov-07 21:43 
AnswerRe: Sql Server 2005 Devloper Edition Pin
Pete O'Hanlon8-Nov-07 1:35
mvePete O'Hanlon8-Nov-07 1:35 
Questiondownload message Pin
foladi7-Nov-07 21:42
professionalfoladi7-Nov-07 21:42 
QuestionBitmap Image to Long Binary Stream Pin
sindhutiwari7-Nov-07 19:50
sindhutiwari7-Nov-07 19:50 
Questionselect apperaring in tables Pin
nicetohaveyou7-Nov-07 17:48
nicetohaveyou7-Nov-07 17:48 
QuestionInsert into DB via Web Service [modified] Pin
ssTahoe7-Nov-07 9:08
ssTahoe7-Nov-07 9:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.