Showing posts with label sql2000. Show all posts
Showing posts with label sql2000. Show all posts

Monday, March 26, 2012

Emailing long messages from SQL2000

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

you can output the query to a file

then have it as an attachment

|||

Thank you very much for the quick response!
I just tried using @.attach_results with xp_sendmail, it properly created a file and emailed it, but the text in the file was still cut off at the same point as before.
Is there any any method of outputting a query to a file?

Thanks again!

|||

hi,

im referrring to this not the other one

xp_sendmail {[@.recipients =] 'recipients [;...n]'}
[,[@.message =] 'message']
[,[@.query =] 'query']
[,[@.attachments =] 'attachments [;...n]']
[,[@.copy_recipients =] 'copy_recipients [;...n]'
[,[@.blind_copy_recipients =] 'blind_copy_recipients [;...n]'
[,[@.subject =] 'subject']
[,[@.type =] 'type']
[,[@.attach_results =] 'attach_value']
[,[@.no_output =] 'output_value']
[,[@.no_header =] 'header_value']
[,[@.width =] width]
[,[@.separator =] 'separator']
[,[@.echo_error =] 'echo_value']
[,[@.set_user =] 'user']
[,[@.dbuse =] 'database']

Arguments

[@.attachments =] 'attachments [;...n]'

Is a semicolon-separated list of files to attach to the mail message.

hope it helps.

regards,

joey

|||Yes, the problem is I don't know how to output data from a stored procedure to a file...|||

use bcp.

call bcp from xp_cmdshell

|||

you could use a Job to move your email into a file and later, send your email.

is it work for you ?

Regards.

|||Did you try some code similar to the one in the sample? Can you check the actual datalength of the value you are trying to return in your query? Using above example, you can do "select datalength(c1) from ##texttab" to verify the length. The query functionality supports text/ntext data so you should be able to create email message >8000 characters.sql

Wednesday, March 7, 2012

EM frozen when viewing tables

Hi,
When I tried to view tables of one my database (sql2000) from Enterprise
manger by clicking on Databases --> <database name> --> Tables, it got
frozen. But if I do it from Query Analyzer, I can query any table as usual.
I
close EM and tried several times, it's still the same. How can I
troubleshoot? ThanksIs this on the actual server or on another workstation using the client tool
s?
In any case, you may need to install SP4 on the client. If it happens on the
server, you need to do an impcat analisys before installing SP4. I would not
be surprised that some applications are not up to date with the current SP
from MS.
"Jen" wrote:

> Hi,
> When I tried to view tables of one my database (sql2000) from Enterprise
> manger by clicking on Databases --> <database name> --> Tables, it got
> frozen. But if I do it from Query Analyzer, I can query any table as usual
. I
> close EM and tried several times, it's still the same. How can I
> troubleshoot? Thanks|||it's on another workstation. Restart service clears it. Thanks
"Edgardo Valdez, MCSD, MCDBA" wrote:
[vbcol=seagreen]
> Is this on the actual server or on another workstation using the client to
ols?
> In any case, you may need to install SP4 on the client. If it happens on t
he
> server, you need to do an impcat analisys before installing SP4. I would n
ot
> be surprised that some applications are not up to date with the current SP
> from MS.
> "Jen" wrote:
>

EM frozen when viewing tables

Hi,
When I tried to view tables of one my database (sql2000) from Enterprise
manger by clicking on Databases --> <database name> --> Tables, it got
frozen. But if I do it from Query Analyzer, I can query any table as usual. I
close EM and tried several times, it's still the same. How can I
troubleshoot? Thanks
Is this on the actual server or on another workstation using the client tools?
In any case, you may need to install SP4 on the client. If it happens on the
server, you need to do an impcat analisys before installing SP4. I would not
be surprised that some applications are not up to date with the current SP
from MS.
"Jen" wrote:

> Hi,
> When I tried to view tables of one my database (sql2000) from Enterprise
> manger by clicking on Databases --> <database name> --> Tables, it got
> frozen. But if I do it from Query Analyzer, I can query any table as usual. I
> close EM and tried several times, it's still the same. How can I
> troubleshoot? Thanks
|||it's on another workstation. Restart service clears it. Thanks
"Edgardo Valdez, MCSD, MCDBA" wrote:
[vbcol=seagreen]
> Is this on the actual server or on another workstation using the client tools?
> In any case, you may need to install SP4 on the client. If it happens on the
> server, you need to do an impcat analisys before installing SP4. I would not
> be surprised that some applications are not up to date with the current SP
> from MS.
> "Jen" wrote:

EM frozen when viewing tables

Hi,
When I tried to view tables of one my database (sql2000) from Enterprise
manger by clicking on Databases --> <database name> --> Tables, it got
frozen. But if I do it from Query Analyzer, I can query any table as usual. I
close EM and tried several times, it's still the same. How can I
troubleshoot? ThanksIs this on the actual server or on another workstation using the client tools?
In any case, you may need to install SP4 on the client. If it happens on the
server, you need to do an impcat analisys before installing SP4. I would not
be surprised that some applications are not up to date with the current SP
from MS.
"Jen" wrote:
> Hi,
> When I tried to view tables of one my database (sql2000) from Enterprise
> manger by clicking on Databases --> <database name> --> Tables, it got
> frozen. But if I do it from Query Analyzer, I can query any table as usual. I
> close EM and tried several times, it's still the same. How can I
> troubleshoot? Thanks|||it's on another workstation. Restart service clears it. Thanks
"Edgardo Valdez, MCSD, MCDBA" wrote:
> Is this on the actual server or on another workstation using the client tools?
> In any case, you may need to install SP4 on the client. If it happens on the
> server, you need to do an impcat analisys before installing SP4. I would not
> be surprised that some applications are not up to date with the current SP
> from MS.
> "Jen" wrote:
> > Hi,
> >
> > When I tried to view tables of one my database (sql2000) from Enterprise
> > manger by clicking on Databases --> <database name> --> Tables, it got
> > frozen. But if I do it from Query Analyzer, I can query any table as usual. I
> > close EM and tried several times, it's still the same. How can I
> > troubleshoot? Thanks

Friday, February 17, 2012

Efficiency of SmallInt vs. SmallDatetime

I have a scheduling db (sql2000) that stores a lot of 'time' data and does
a lot of operations on this data. I'm storing event dates in a smalldatetime
field. I'm storing a 'starttime' in another smalldatetime field (eg. as
'1/1/1900 9:30') and 'endtime' in a third smalldatetime field ( eg. as
'1/1/1900 11:30').
Does anyone have any information/ideas on what performance improvements I
might see if was to instead store the 2 'time' fields as smallints (storing
number of minutes since midnight) rather than as smalldatetimes? I
understand I would halve the storage required, what about performance per
se?
Thanks,
Paul.
Hi
Every row in a Table has an overhead of about 20 bytes. Saving a byte here
or there does not help much. You have to do a lot more processing to convert
your time to smallint and back (in your code).
Have you tested the difference? Functions like dateadd and datediff and not
avilable to you if you don't use DateTime datatypes.
Regards
Mike
"Paul W" wrote:

> I have a scheduling db (sql2000) that stores a lot of 'time' data and does
> a lot of operations on this data. I'm storing event dates in a smalldatetime
> field. I'm storing a 'starttime' in another smalldatetime field (eg. as
> '1/1/1900 9:30') and 'endtime' in a third smalldatetime field ( eg. as
> '1/1/1900 11:30').
> Does anyone have any information/ideas on what performance improvements I
> might see if was to instead store the 2 'time' fields as smallints (storing
> number of minutes since midnight) rather than as smalldatetimes? I
> understand I would halve the storage required, what about performance per
> se?
> Thanks,
> Paul.
>
>

Efficiency of SmallInt vs. SmallDatetime

I have a scheduling db (sql2000) that stores a lot of 'time' data and does
a lot of operations on this data. I'm storing event dates in a smalldatetime
field. I'm storing a 'starttime' in another smalldatetime field (eg. as
'1/1/1900 9:30') and 'endtime' in a third smalldatetime field ( eg. as
'1/1/1900 11:30').
Does anyone have any information/ideas on what performance improvements I
might see if was to instead store the 2 'time' fields as smallints (storing
number of minutes since midnight) rather than as smalldatetimes? I
understand I would halve the storage required, what about performance per
se?
Thanks,
Paul.Hi
Every row in a Table has an overhead of about 20 bytes. Saving a byte here
or there does not help much. You have to do a lot more processing to convert
your time to smallint and back (in your code).
Have you tested the difference? Functions like dateadd and datediff and not
avilable to you if you don't use DateTime datatypes.
Regards
Mike
"Paul W" wrote:
> I have a scheduling db (sql2000) that stores a lot of 'time' data and does
> a lot of operations on this data. I'm storing event dates in a smalldatetime
> field. I'm storing a 'starttime' in another smalldatetime field (eg. as
> '1/1/1900 9:30') and 'endtime' in a third smalldatetime field ( eg. as
> '1/1/1900 11:30').
> Does anyone have any information/ideas on what performance improvements I
> might see if was to instead store the 2 'time' fields as smallints (storing
> number of minutes since midnight) rather than as smalldatetimes? I
> understand I would halve the storage required, what about performance per
> se?
> Thanks,
> Paul.
>
>