Emailing Long Messages From SQL2000
Oct 26, 2006
Hello!
The problem is this.
I have many short messages in a table. I need to tigh them together in one long email message and email to the users.
But xp_sendmail is limited to 7,790.
How could I send longer messages? Or how could I devide the long message and send it in parts (i.e. separate consequtive emails)?
This doesn't work, it still cuts the messages off at around 7,790:
E. Send messages longer than 7,990 characters
This example shows how to send a message longer than 7,990 characters. Because message is limited to the length of a varchar (less row overhead, as are all stored procedure parameters), this example writes the long message into a global temporary table consisting of a single text column. The contents of this temporary table are then sent in mail using the @query parameter. CREATE TABLE ##texttab (c1 text)
INSERT ##texttab values ('Put your long message here.')
DECLARE @cmd varchar(56)
SET @cmd = 'SELECT c1 FROM ##texttab'
EXEC master.dbo.xp_sendmail 'robertk',
@query = @cmd, @no_header= 'TRUE'
DROP TABLE ##texttab
View 7 Replies
ADVERTISEMENT
Oct 20, 2002
Hi there!
Is there a way, I can setup create a script that I can schedule, which runs through my user databases and if e.g.:
1:) there is less than 20% free space it emails me.
and/or
2:) there is less than 200MB free space
it emails me.
Cheers
Henrik Hansen
View 6 Replies
View Related
Jul 20, 2005
Hi everybody,i try to send messages longer than 7990 characters from a text fieldin SSQL2000. Unfortunatly the messages get cut off after 7990character.I did everything which is described in BOL (see below). It does notsolve the problem. Upgraded to newest Outlook Client and tried to sendas an attachment also. No success though.Does anybody have a hint before i contact Microsoft.RegardsYorn Ziesche[color=blue]>E. Send messages longer than 7,990 characters[/color]This example shows how to send a message longer than 7,990 characters.Because message is limited to the length of a varchar (less rowoverhead, asare all stored procedure parameters), this example writes the longmessageinto a global temporary table consisting of a single text column. Thecontents of this temporary table are then sent in mail using the@queryparameter.CREATE TABLE ##texttab (c1 text)INSERT ##texttab values ('Put your long message here.')DECLARE @cmd varchar(56)SET @cmd = 'SELECT c1 FROM ##texttab'EXEC master.dbo.xp_sendmail 'robertk',@query = @cmd, @no_header= 'TRUE'DROP TABLE ##texttab
View 3 Replies
View Related
Mar 14, 2004
Hey,
I would like to set up a job to send mail out to clients on a semi-regular basis. Is there a way to mail directly from MS SQL.
or some application which I can set to interface with MS SQL and send these mails out.
I'm currently using asp.net, however, doing it through the web is very time consuming, I would much rather use some application to generate the mails on the server as it currently takes close to 20 min to send through the web interface (and that's only to 900 members, we are looking at having at least 2000 members in a few weeks). What am I looking for is something I can call perhaps with transact sql so I can run it through an ms sql server job, however any solution you have would be fantastic.
If you don't have specific details, that's fine, I'm not even sure what apps etc to look into, even a name of some technology to use (or does MS SQL have a way of doing all of this itself?)
Thanks a lot for your help, life saver ;-)
View 8 Replies
View Related
Apr 13, 2000
I need to send the output of a report generated, automatically through email as an attachment to some customer.Is it possible?Can anyone help?
View 1 Replies
View Related
Dec 8, 2004
Hi everyone,
I am running SQL Server Enterprise Manager and i would like to have a query run everynite and send the results returned by the query off to an email address....
How can i do this?
View 3 Replies
View Related
Nov 5, 2004
Hi everyone I have a database that I am creating for another department. He emails applications to potential vendors. And I was wanting sql to do this for him. I was reading about xtended procedures XP_Sendmail, but this is the first time I have created an extended stored procedure. I need for it to email an attachment (the report)
View 1 Replies
View Related
Feb 7, 2006
I have a DTS package that runs 4x a day and generates an excel spreadsheet, renames that spreadsheet with a datetime stamp and then places it into a folder on our network. I have been asked to email that spreadsheet to someone everytime the package runs.
My question is what would be the best way to handle this and how do I ensure that whatever process I define grabs the correct file? The folder that the Excel file is being placed into has multiple files in it. Is there a way to tell SQL Server which file to grab and email?
Any thoughts or suggestions would be greatly appreciated! Thanks!
Frank
View 1 Replies
View Related
Feb 19, 2007
I'm sort of new to SSIS so I apologize if this is a trivial question:
I setup a package and want it to email me if there is any errors. Right now I got it working to send me a pre-written message about the failure, but I want to load the full task failure message into variable and email it on the email body.
But so far I have not found a way to save the error messages into variables so I can email them. Anyone can help with that one?
View 4 Replies
View Related
Apr 5, 2007
I need to export a view into excel and mail to my manager daily morning. Is there a way i can automate this process. I know how to convert view to excel but i need a better solution to automate this process with emailing to my mgr. Please suggest a better approach of doing this.
Thanks,
View 5 Replies
View Related
Jan 5, 2001
Whenever a certain stored procedure executes I need to email both admin and clients (different messages). I have created an error within the SP and can RAISE the error and thus notify admin staff but how can i email the client also ? I can obtain the cient email address from thye system but how can i email them ? Can i use xp_sendmail within a stored procedure ? If so, how as i can't seem to get it working ?
thanks for help
View 1 Replies
View Related
Oct 21, 2004
Is there a way to have SQL server email the results of a Select query to someone?
View 1 Replies
View Related
Jan 8, 2008
Hi,
Is there a built in capability with sql server 2005 which sends emails to users upon a record insertion.
Thanks
View 2 Replies
View Related
Aug 31, 2007
Hi ,
Is it possible for us to send an excel file generated in the package to the users using Sendmail task or anyother task using SSIS?
Any help is greatly appreciated.
Thanks,
SVGP.
View 5 Replies
View Related
Jun 28, 2006
Hello,
I am trying to use €œSQL Server Business Intelligence Development Studio€? (what is the short name for this) to complete a check and then possibly email me depending on what happens.
The check is around two tables that I have. There is a chance that they will become out of sync with each other and so I want to know when a field (ACCOUNTID) has a value that is in one table and not the other. I can do the check but I would like the package to email me when there is a problem (and if possible email me the details) and do nothing when everything is OK.
Can anybody give me some hints to point me in the correct direction as I just seem to be chasing my tail at the moment,
Thanks,
View 5 Replies
View Related
Sep 12, 2007
Hi Rafael,
I need to create a new excel file daily and then need to mail it.
The problem iam facing is that ,when i schedule a job the task that dumps data into excel(Dataflow task ) gives a validation error.Everytime i need to manually link the sheets of the excel to the corresponding tables.
Any idea why this is happening?So iam unable to schedule as a job...
Thanks,
Vani.
View 3 Replies
View Related
Feb 4, 2008
Hi All
I'm hoping someone here will be able to guide me in the right direction. I am trying to figure out a way of looping through table columns or a flat file in which there will be three parameters every time. With these parameters I am then wanting to run a report using two of these parameters to feed into the report and then email this out to an email address which would be my third parameter. Does anyone here have any idea how I would go about doing this?
Many thanks in advance.
View 5 Replies
View Related
Apr 2, 2008
Hello, please help!!
I have spent days searching the web and forums for an answer to this simple question and cannot find an example.
I have built a service broker application on sql server 2005. The application puts some xml on an incoming queue which is basically a few parameters to be used in a query. This queue will then call a stored proc which does some business logic and puts the resulting results in another queue also in xml.
I have written a test harness in SQL to put messages on the inbound queue and then some sql to retrieve the returned code from the outbound queue.
What I want to do is be able to convert the SQL which does this into .net code to be used by an application. i.e. write in .net some code to put xml on a queue and then write some .net code to retrieve xml from another queue.
I wouldn't have thought this would be a difficult thing to do and would have been done hundreds of times, but unable to find anything to simply send and retrieve XML to service broker queues....
thanks for your help.. its really needed. I found some links, but they are really vague and often doing select statments in service broker or something like this. I don't want to call any sql, just send and recieve XML on the queues.
any example code that does this, would be really helpfull
kind regards,
David Weeden
Database Developer
View 2 Replies
View Related
Jun 19, 2014
I have downloaded MS's performance dashboard report and installed. I wanted these report should automatically send the performance report to my email.
View 1 Replies
View Related
Apr 8, 2015
I am trying to create an alert when there are more than 2500 connections to our ailing SQL Server.However, for now, I need to restart the SQL server service because users begin complaining they can't connect.
1) I created an operator - me.
2) I created a job which runs a query.
INSERT INTO Sessions_alert
SELECT host_name, program_name, login_name, count(c.session_id ) num_sessions, getdate()
FROM sys.dm_exec_connections c JOIN sys.dm_exec_sessions s on c.session_id = s.session_id
GROUP BY host_name,program_name,login_name ORDER BY 4 DESC
3) I created an alert - included the job from above. Type performance condition alert. Object - SQL Server General Statistics. Counter - User connections.Alert if counter rises above 50. Just testing. I really want to know when it gets past 2500.
4) I've set the alert to email and delay is between responses 2 minutes.
It history tables says number of occurences is 18964. However, I don't receive an email.
Shouldn't the alert send an email? Do I need to include email code in the job?
View 6 Replies
View Related
Jul 10, 2007
I want to send a deployed report (report manager), through email, by calling reportingServices webservice. But the requirement is that, time is not fixed for sending this email, so I want to trigger the sending of report as a one time event, no subscription to a daily time...
How should I go about it?
View 1 Replies
View Related
Sep 17, 2006
i have sql2000 & sql2005 on the same machine. I am unable to register my localhost in sql2000, get an access denied error. How can I make my localhost use sql2000 database?
View 1 Replies
View Related
May 13, 2008
i am in the process of Migrating SQL 2000 to my new SQL2000 server i want to know the what would the best way for me to migrate one SQL server to another SQL server on the same network and rename the new server to the old server and bring it up for use in our ecommerce website.
View 10 Replies
View Related
Feb 3, 2014
I am using this code for LongRunning Queries.
CREATE EVENT SESSION LongRunningQuery
ON SERVER
ADD EVENT sqlserver.sql_statement_completed
(
ACTION (sqlserver.sql_text, sqlserver.tsql_stack)
WHERE sqlserver.sql_statement_completed.duration > 60000
[Code] ...
Here Instead of writing to XML file how can send an EMAIL if a query runs more than 1 minute in my server ?
View 2 Replies
View Related
Feb 15, 1999
Trying to obtain a full list of SQL 6.5 error messages into a file. There are
2,215 messages present in master.sysmessages, but there is a total of 2,733
messages listed in the dialog box within enterprise manager. Message numbers
17026 thru 19020 don't seem to be stored in the sysmessages table.
Anyone know how I could obtain an extract to obtain a full list of messages ?
View 2 Replies
View Related
Apr 15, 2008
After sending a message the message is just gone.
Our transmissionand and out our transactionqueue is empty.
This is our CLIENT:
CREATE MESSAGE TYPE HelloWorldMessage
VALIDATION = WELL_FORMED_XML ;
GO
CREATE CONTRACT HelloWorldContract
( HelloWorldMessage SENT BY INITIATOR);
GO
CREATE QUEUE [dbo].[InitiatorQueue] ;
GO
CREATE SERVICE InitiatorService
ON QUEUE [dbo].[InitiatorQueue];
GO
drop endpoint SqlEndpoint
CREATE ENDPOINT SqlEndpoint
STATE = STARTED
AS TCP (LISTENER_PORT = 1235, LISTENER_IP =ALL)
FOR service_broker(AUTHENTICATION = WINDOWS)
GO
use master
GRANT CONNECT ON ENDPOINT:qlEndpoint to public
GO
use test1
DROP ROUTE SqlRoute
GO
CREATE ROUTE SqlRoute
AUTHORIZATION [dbo]
WITH
SERVICE_NAME = 'TargetService',
BROKER_INSTANCE = '80EFDE56-4088-4015-B6C0-D12285C60F66',
ADDRESS = 'TCP://localhost:5900';
GO
GRANT SEND ON SERVICE::[TargetService] to public
create master key
encryption by password = 'azertyuiopqsdfghjklm'
go
SERVER
CREATE MESSAGE TYPE HelloWorldMessage
VALIDATION = WELL_FORMED_XML ;
GO
CREATE CONTRACT HelloWorldContract
( HelloWorldMessage SENT BY INITIATOR);
GO
CREATE QUEUE [dbo].[InitiatorQueue] ;
GO
CREATE SERVICE InitiatorService
ON QUEUE [dbo].[InitiatorQueue];
GO
drop endpoint SqlEndpoint
CREATE ENDPOINT SqlEndpoint
STATE = STARTED
AS TCP (LISTENER_PORT = 1235, LISTENER_IP =ALL)
FOR service_broker(AUTHENTICATION = WINDOWS)
GO
use master
GRANT CONNECT ON ENDPOINT:qlEndpoint to public
GO
use test1
DROP ROUTE SqlRoute
GO
CREATE ROUTE SqlRoute
AUTHORIZATION [dbo]
WITH
SERVICE_NAME = 'TargetService',
BROKER_INSTANCE = '80EFDE56-4088-4015-B6C0-D12285C60F66',
ADDRESS = 'TCP://localhost:5900';
GO
GRANT SEND ON SERVICE::[TargetService] to public
create master key
encryption by password = 'azertyuiopqsdfghjklm'
go
Hopefull you have an idea?
View 1 Replies
View Related
Dec 4, 2007
I am writing a tracking system. There is a table in the Sql Server 2000 database that contains a column for the user's ntid, the page they visited, the date of the last visit, a column each to track hits for the current year and a previous year column (basically for archiveing and reporting purposes), and 12 columns for hits per month (obviously, one per column). To record a hit, my unit determined we would only track one hit per day, so basically, there are 3 possible outcomes I needed to account for :
1) A user had never hit the page before, so I need to record the user's ID, the page they hit for the first time (since it won't exist yet), increment the year counter for that user on that page, and then determine what month column counter should be incremented as well.
2) A user had hit the page before, but not on this same day, so I need to update the row for that user on that page, changing the last visit field to reflect the current date, and icnrementing the appropriate counters.
3) A user had hit the page already on the same day, so basically, nothing should be changed whatsoever. No action should be taken.
I wrote a stored procedure to attempt to accomplish that logic, and though it's probably not very pretty, I was surprised at how few errors I got on my first Syntax check. Here's the stored procedure :
CREATE PROCEDURE sp_hitMe@ntid varchar(10),@page varchar(50),@thisHit datetimeASSET NOCOUNT ON
DECLARE @tempDate datetimeDECLARE @yearCount intDECLARE @monthCount intDECLARE @inMonth varchar(20)DECLARE @monthColumn varchar(10)SET @inMonth = DATENAME(mm, @thisHit)SET @monthColumn = CASE WHEN @inMonth = 'January' THEN 'hitsInJan' WHEN @inMonth = 'February' THEN 'hitsInFeb' WHEN @inMonth = 'March' THEN 'hitsInMar' WHEN @inMonth = 'April' THEN 'hitsInApr' WHEN @inMonth = 'May' THEN 'hitsInMay' WHEN @inMonth = 'June' THEN 'hitsInJun' WHEN @inMonth = 'July' THEN 'hitsInJul' WHEN @inMonth = 'August' THEN 'hitsInAug' WHEN @inMonth = 'September' THEN 'hitsInSep' WHEN @inMonth = 'October' THEN 'hitsInOct' WHEN @inMonth = 'November' THEN 'hitsInNov' WHEN @inMonth = 'December' THEN 'hitsInDec' END DECLARE @insString varchar(500)DECLARE @updString varchar(500)SET @insString = 'INSERT INTO tblTracking (ntid, page, lastVisit, hitsThisYear, ' + @monthColumn + ') VALUES (' + @ntid + ', ' + @page + ', ' + @thisHit + ', 1, 1)'
if exists(select * from tblTracking where ntid = @ntid and @page = page) begin if exists(select * from tblTracking where lastVisit = @thisHit) begin -- DO NOTHING! end else begin DECLARE @theColumn varchar (100) SET @theColumn = 'SELECT ' + @monthColumn + ' FROM tblTracking WHERE ntid = @ntid AND @page = page' SET @yearCount = (SELECT hitsThisYear FROM tblTracking WHERE ntid = @ntid AND @page = page) + 1 SET @monthCount = (Exec @theColumn) SET @monthCount = @monthCount + 1 SET @updString = 'UPDATE tblTracking SET lastVisit = ' + @thisHit + ', hitsThisYear = ' + @yearCount + ', ' + @monthColumn + ' = ' + @monthCount + ' WHERE ntid = @ntid AND @page = page' Exec @updString end endelse begin Exec @insString endGO
And to my surprise, the only 3 errors I got were :
Server: Msg 156, Level 15, State 1, Procedure sp_hitMe, Line 39Incorrect syntax near the keyword 'end'.Server: Msg 156, Level 15, State 1, Procedure sp_hitMe, Line 45Incorrect syntax near the keyword 'Exec'.Server: Msg 156, Level 15, State 1, Procedure sp_hitMe, Line 50Incorrect syntax near the keyword 'end'.
However, these are of course so vague as to be useless to me. What's wrong with the procedure? What have I missed?
View 9 Replies
View Related
Sep 26, 2005
i'm trying to make private messages like the one in this site, i didnt start programming yet, the problem is in the DB schema, i have 3 tables (Users, Messages, MessageDetails) i think the problem that the UserID is related to the other two Tables, so to know the sender and reciever, when i try to view all messages for specific user and show all users who sent it, it give nothing back, so any help in the DB, thanx 4 help.
View 13 Replies
View Related
Mar 9, 1999
Is there a way to return the SQL Native error to a Visual Basic program?
View 3 Replies
View Related
Mar 3, 1999
Hey everyone,
Here is what I'm doing:
exec xp_sendmail @recipients = 'ampx@hotmail.com',
@query = 'select * from information where recid <= 10',
@subject = 'Query test',
@message = 'hello',
@attach_results = 'TRUE',
@width = 250
I get this error:
Msg 2812, Level 16, State 4
Stored procedure 'xp_sendmail' not found.
Anyone know why? isn't xp_sendmail a function of SQL?
Thanks
View 1 Replies
View Related
Jul 18, 2006
I have a website with a DB table of messages sent by users.
I want to select the first 3 messages for each unique user.
I found a way to accomplish this by pulling all of the messages from the sql and filtering the results via ASP.net code but it seems to be really really slow.
I hope one of you guys can help me accomplish this via sql .
Messages Table
Mid Username SendDate
110016/07/06 13:00
210017/07/06 14:00
310117/07/06 14:30
410217/07/06 15:00
510318/07/06 16:00
610018/07/06 17:00
710218/07/06 18:01
810319/07/06 18:02
911019/07/06 19:03
1010219/07/06 19:04
1110021/07/06 20:00
1210321/07/06 20:00
1310221/07/06 20:00
Query result:
Mid
1
2
6
3
4
7
10
5
8
12
9
THANK you guys!
View 9 Replies
View Related
Apr 30, 2007
Hi,
I have a table that has 4 fields and has free format text messages. The Identification field contains the client id
MNo field has Message Number specific client id. A single messge is split down into multiple rows and Seq field gives the relation which text message belongs to which MNo
Message table:
IdentificationMNoSeqText
CLIENT-01980001001This is the header record for client ABS.
CLIENT-01426001001This is the Header Record for DAN client #1426
CLIENT-01327001001This is the Header record for Glaxo Client
CLIENT-01327002001Jen: pursuant to my conversation via phone with you and Mel on 9/20
CLIENT-01327002002regarding the Pete relocation, there is concern as to whether this
CLIENT-01327002003sale is good or not. It appears that the prospective buy
CLIENT-01327002004er will be in tommorrow if he does not produce a firm fina
CLIENT-01327002005ncing commitment by that date.
CLIENT-01327003001Message for client A
CLIENT-09970001001This is the header record for client Nestle
I need to create a query where i need to join all the text messages that belong to the same MNo and Identification into one field. The output should be like the following:
Output Message table:
IdentificationMNoSeqText
CLIENT-01980001001This is the header record for client ABS.
CLIENT-01426001001This is the Header Record for DAN client #1426
CLIENT-01327001001This is the Header record for Glaxo Client
CLIENT-01327002001Jen: pursuant to my conversation via phone with you and Mel on 9/20 regarding the Pete relocation, there is concern as to whether this sale is good or
or not. It appears that the prospective buyer will be in tommorrow if he does not produce a firm financing commitment by that date.
CLIENT-01327003001Message for client A
CLIENT-09970001001This is the header record for client Nestle
In the above output table for Identification = CLIENT-01327 and Mno = 002 the entire text message has been concantenated into one field.
Is there any way that i can write in a single query to obtain the output file.. Please help.
View 2 Replies
View Related
Jul 20, 2005
Hello,I'd like to know if I use DTS. If I use it immediately, I can see the errorin the dialog box, instead, if I use it with scheduling, where Can I checkthe error ?ThanksSaimon(Florence)
View 2 Replies
View Related