Showing posts with label online. Show all posts
Showing posts with label online. Show all posts

Tuesday, March 27, 2012

About @@ERROR in SQL 2005 online book

Here

http://msdn2.microsoft.com/en-us/library/ms190193.aspx

it is explained that @.@.ERROR will be cleared and reset.

But here:

http://msdn2.microsoft.com/en-us/library/ms190248.aspx

http://msdn2.microsoft.com/en-us/library/ms187009.aspx

we still see:

IF (@.@.ERROR <> 0)

SET @.ErrorSave = @.@.ERROR

Chester

Is there a question here?

I assume you are asking if @.@.Error is reset during the IF statement. If you read the first link, it says NO.

http://msdn2.microsoft.com/en-us/library/ms190193.aspx

@.@.Error is reset by the next TSQL command. IF is a conditional statement and does not reset the flag.|||

Hi Chester,

The second example is indeed incorrect as @.@.error will be reset to 0 by the IF statement. The local @.ErrorSave should be set after each statement and them compared:

declare @.a int, @.ErrorSave int;

set @.a = (1 / 0); -- divide by zero

set @.ErrorSave = @.@.ERROR;

if (@.ErrorSave <> 0)
begin
select @.ErrorSave AS [ErrorNumber]
end

Cheers,
Rob

|||

Hi Tom,

That's sort of incorrect - the IF will return TRUE when evaluating the statement "IF (@.@.EROR <> 0)", however @.@.ERROR is then reset by the successful completion of the evaluation:

declare @.a int, @.ErrorSave int;

set @.a = (1 / 0); -- divide by zero

if (@.@.error <> 0)
begin
select @.@.error AS [ErrorNumber] -- will return 0
end

Cheers,
Rob

|||

Here

http://msdn2.microsoft.com/en-us/library/ms190193.aspx

It says exactly:

Conditional statements, such as the IF statement, reset @.@.ERROR. If you reference @.@.ERROR in an IF statement, references to @.@.ERROR in the IF or ELSE blocks will not retrieve the @.@.ERROR information. In the following example, @.@.ERROR is reset by IF and does not return the error number when referenced in the PRINT statement.

|||

Thanks, Robert.

Actually I found this problem in one of our partner's application that was wriiten by a local Robert.

When I checked the online book, it was misleading at first .

Chester

|||Yep, you are right, my mistake.

@.@.Error is reset by the IF. The best thing to do is: SET @.errorcode = @.@.ERROR right after the command.

The @.@.Error traps so little errors, it is almost worthless. Most of the time the error in the command just terminates the stored proc and never gets to the error trap anyway, unless you use Try/Catch.

About @@ERROR in SQL 2005 online book

Here

http://msdn2.microsoft.com/en-us/library/ms190193.aspx

it is explained that @.@.ERROR will be cleared and reset.

But here:

http://msdn2.microsoft.com/en-us/library/ms190248.aspx

http://msdn2.microsoft.com/en-us/library/ms187009.aspx

we still see:

IF (@.@.ERROR <> 0)

SET @.ErrorSave = @.@.ERROR

Chester

Is there a question here?

I assume you are asking if @.@.Error is reset during the IF statement. If you read the first link, it says NO.

http://msdn2.microsoft.com/en-us/library/ms190193.aspx

@.@.Error is reset by the next TSQL command. IF is a conditional statement and does not reset the flag.|||

Hi Chester,

The second example is indeed incorrect as @.@.error will be reset to 0 by the IF statement. The local @.ErrorSave should be set after each statement and them compared:

declare @.a int, @.ErrorSave int;

set @.a = (1 / 0); -- divide by zero

set @.ErrorSave = @.@.ERROR;

if (@.ErrorSave <> 0)
begin
select @.ErrorSave AS [ErrorNumber]
end

Cheers,
Rob

|||

Hi Tom,

That's sort of incorrect - the IF will return TRUE when evaluating the statement "IF (@.@.EROR <> 0)", however @.@.ERROR is then reset by the successful completion of the evaluation:

declare @.a int, @.ErrorSave int;

set @.a = (1 / 0); -- divide by zero

if (@.@.error <> 0)
begin
select @.@.error AS [ErrorNumber] -- will return 0
end

Cheers,
Rob

|||

Here

http://msdn2.microsoft.com/en-us/library/ms190193.aspx

It says exactly:

Conditional statements, such as the IF statement, reset @.@.ERROR. If you reference @.@.ERROR in an IF statement, references to @.@.ERROR in the IF or ELSE blocks will not retrieve the @.@.ERROR information. In the following example, @.@.ERROR is reset by IF and does not return the error number when referenced in the PRINT statement.

|||

Thanks, Robert.

Actually I found this problem in one of our partner's application that was wriiten by a local Robert.

When I checked the online book, it was misleading at first .

Chester

|||Yep, you are right, my mistake.

@.@.Error is reset by the IF. The best thing to do is: SET @.errorcode = @.@.ERROR right after the command.

The @.@.Error traps so little errors, it is almost worthless. Most of the time the error in the command just terminates the stored proc and never gets to the error trap anyway, unless you use Try/Catch.sql

Friday, February 24, 2012

a question about sp_monitor

On the Books Online for sp_monitor:
total_read Number of reads by SQL Server.
total_write Number of writes by SQL Server.
Can anybody explain what is Number of Reads/Writes mean? Is it the number of
bytes read/Write?
Thanks,
LijunThey are same as @.@.total_read (or @.@.total_write), and they are the total
number of disk reads (or writes) by SQL Server since it starts. So they are
definitely not the number of bytes read or written.
I don't use sp_monitor, and I don't know anybody who uses sp_monitor for any
sort of practical performance tuning or troubleshooting purposes.
Linchi
"Lijun Zhang" wrote:

> On the Books Online for sp_monitor:
> total_read Number of reads by SQL Server.
> total_write Number of writes by SQL Server.
>
> Can anybody explain what is Number of Reads/Writes mean? Is it the number
of
> bytes read/Write?
> Thanks,
> Lijun
>
>|||Thanks, Linchi. What I am trying to do is to get number of bytes read/write
for a period of time. We are looking at buy a new server to replace one of
the production servers, and I am trying to get the bandwidth requirements.
Do you know how to get the counters? Is System Monitor the only tool I can
use?
Lijun
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:4E872DCB-ADB7-4CFD-85FB-44F4A73035F7@.microsoft.com...[vbcol=seagreen]
> They are same as @.@.total_read (or @.@.total_write), and they are the total
> number of disk reads (or writes) by SQL Server since it starts. So they
> are
> definitely not the number of bytes read or written.
> I don't use sp_monitor, and I don't know anybody who uses sp_monitor for
> any
> sort of practical performance tuning or troubleshooting purposes.
> Linchi
> "Lijun Zhang" wrote:
>|||That won't tell you any kind of bandwidth. Exactly what are you trying to
determine the server or the storage?
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Lijun Zhang" <sonyzhang00@.yahoo.com> wrote in message
news:e%23ndhA8SIHA.2000@.TK2MSFTNGP05.phx.gbl...
> Thanks, Linchi. What I am trying to do is to get number of bytes
> read/write for a period of time. We are looking at buy a new server to
> replace one of the production servers, and I am trying to get the
> bandwidth requirements.
> Do you know how to get the counters? Is System Monitor the only tool I can
> use?
> Lijun
>
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
> news:4E872DCB-ADB7-4CFD-85FB-44F4A73035F7@.microsoft.com...
>

a question about sp_monitor

On the Books Online for sp_monitor:
total_read Number of reads by SQL Server.
total_write Number of writes by SQL Server.
Can anybody explain what is Number of Reads/Writes mean? Is it the number of
bytes read/Write?
Thanks,
Lijun
They are same as @.@.total_read (or @.@.total_write), and they are the total
number of disk reads (or writes) by SQL Server since it starts. So they are
definitely not the number of bytes read or written.
I don't use sp_monitor, and I don't know anybody who uses sp_monitor for any
sort of practical performance tuning or troubleshooting purposes.
Linchi
"Lijun Zhang" wrote:

> On the Books Online for sp_monitor:
> total_read Number of reads by SQL Server.
> total_write Number of writes by SQL Server.
>
> Can anybody explain what is Number of Reads/Writes mean? Is it the number of
> bytes read/Write?
> Thanks,
> Lijun
>
>
|||Thanks, Linchi. What I am trying to do is to get number of bytes read/write
for a period of time. We are looking at buy a new server to replace one of
the production servers, and I am trying to get the bandwidth requirements.
Do you know how to get the counters? Is System Monitor the only tool I can
use?
Lijun
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:4E872DCB-ADB7-4CFD-85FB-44F4A73035F7@.microsoft.com...[vbcol=seagreen]
> They are same as @.@.total_read (or @.@.total_write), and they are the total
> number of disk reads (or writes) by SQL Server since it starts. So they
> are
> definitely not the number of bytes read or written.
> I don't use sp_monitor, and I don't know anybody who uses sp_monitor for
> any
> sort of practical performance tuning or troubleshooting purposes.
> Linchi
> "Lijun Zhang" wrote:
|||That won't tell you any kind of bandwidth. Exactly what are you trying to
determine the server or the storage?
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Lijun Zhang" <sonyzhang00@.yahoo.com> wrote in message
news:e%23ndhA8SIHA.2000@.TK2MSFTNGP05.phx.gbl...
> Thanks, Linchi. What I am trying to do is to get number of bytes
> read/write for a period of time. We are looking at buy a new server to
> replace one of the production servers, and I am trying to get the
> bandwidth requirements.
> Do you know how to get the counters? Is System Monitor the only tool I can
> use?
> Lijun
>
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
> news:4E872DCB-ADB7-4CFD-85FB-44F4A73035F7@.microsoft.com...
>

a question about sp_monitor

On the Books Online for sp_monitor:
total_read Number of reads by SQL Server.
total_write Number of writes by SQL Server.
Can anybody explain what is Number of Reads/Writes mean? Is it the number of
bytes read/Write?
Thanks,
LijunThey are same as @.@.total_read (or @.@.total_write), and they are the total
number of disk reads (or writes) by SQL Server since it starts. So they are
definitely not the number of bytes read or written.
I don't use sp_monitor, and I don't know anybody who uses sp_monitor for any
sort of practical performance tuning or troubleshooting purposes.
Linchi
"Lijun Zhang" wrote:
> On the Books Online for sp_monitor:
> total_read Number of reads by SQL Server.
> total_write Number of writes by SQL Server.
>
> Can anybody explain what is Number of Reads/Writes mean? Is it the number of
> bytes read/Write?
> Thanks,
> Lijun
>
>|||Thanks, Linchi. What I am trying to do is to get number of bytes read/write
for a period of time. We are looking at buy a new server to replace one of
the production servers, and I am trying to get the bandwidth requirements.
Do you know how to get the counters? Is System Monitor the only tool I can
use?
Lijun
"Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
news:4E872DCB-ADB7-4CFD-85FB-44F4A73035F7@.microsoft.com...
> They are same as @.@.total_read (or @.@.total_write), and they are the total
> number of disk reads (or writes) by SQL Server since it starts. So they
> are
> definitely not the number of bytes read or written.
> I don't use sp_monitor, and I don't know anybody who uses sp_monitor for
> any
> sort of practical performance tuning or troubleshooting purposes.
> Linchi
> "Lijun Zhang" wrote:
>> On the Books Online for sp_monitor:
>> total_read Number of reads by SQL Server.
>> total_write Number of writes by SQL Server.
>>
>> Can anybody explain what is Number of Reads/Writes mean? Is it the number
>> of
>> bytes read/Write?
>> Thanks,
>> Lijun
>>|||That won't tell you any kind of bandwidth. Exactly what are you trying to
determine the server or the storage?
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Lijun Zhang" <sonyzhang00@.yahoo.com> wrote in message
news:e%23ndhA8SIHA.2000@.TK2MSFTNGP05.phx.gbl...
> Thanks, Linchi. What I am trying to do is to get number of bytes
> read/write for a period of time. We are looking at buy a new server to
> replace one of the production servers, and I am trying to get the
> bandwidth requirements.
> Do you know how to get the counters? Is System Monitor the only tool I can
> use?
> Lijun
>
> "Linchi Shea" <LinchiShea@.discussions.microsoft.com> wrote in message
> news:4E872DCB-ADB7-4CFD-85FB-44F4A73035F7@.microsoft.com...
>> They are same as @.@.total_read (or @.@.total_write), and they are the total
>> number of disk reads (or writes) by SQL Server since it starts. So they
>> are
>> definitely not the number of bytes read or written.
>> I don't use sp_monitor, and I don't know anybody who uses sp_monitor for
>> any
>> sort of practical performance tuning or troubleshooting purposes.
>> Linchi
>> "Lijun Zhang" wrote:
>> On the Books Online for sp_monitor:
>> total_read Number of reads by SQL Server.
>> total_write Number of writes by SQL Server.
>>
>> Can anybody explain what is Number of Reads/Writes mean? Is it the
>> number of
>> bytes read/Write?
>> Thanks,
>> Lijun
>>
>

Monday, February 13, 2012

A more consistant Web Report Viewer?

Is there another way of displaying reports online that will show the data exactly as it wil be printed?

A number of things have been causing me problems, such as the fact that the pagination controls do not show the same number of pages that actualy get printed. And some fields in the the report viewer do not line up with their column headers, but on the print outs they do.

We used to use Crystal reports, and would like the report viewer to act in a similar manor to their ActiveX report viewer.

Any help is greatly apprechiated.

Many thanks

Matt

I am kindof shooting from the hip here without looking into it too deeply, but I am pretty sure that you can specify CSS as they apply to viewed reports. In doing so, there should be a "print.css", which can be altered as well. This may not be the solution that you are looking for, but I think that it would merit some looking in to.

Hope this helps a bit,

Nathan

|||

Hi Nathan,

Thanks for your comments, but thats not exactly what i was after.

I just had a thought though, there obvously is an activex control that can render the report as this is launched in the print preview.

Does anybody know how to use this renderer as the viewer embeded in a HTML page?

Cheers

Matt

|||

Hi Matt,

Print uses the EMF image extension. You can find the details here: http://msdn2.microsoft.com/en-us/library/ms155373.aspx

If you set the PageHeight and PageWidth properties of your report and use the same margins, this will make the web viewer more similar to the view of Print.

|||You can try displaying the EMF yourself, but I would guess that PDF might be more useable since you don't need to actually write an application to display it. For EMF, you are going to have to write something actually display the metafile that we send.|||

Hi Guys,

Thanks for your feedback.

Brad: I have played around with the Page propeties, however i could not get them to match the printouts exactly (which in this instance is what i need to be able to do), but thanks for the details on EMF, i'll definatley look into it.

John: I will look at how viable using PDF is in our situation, but i think the EMF file might be the way i have to go.

Does anybody have any info on converting a report into and EMF file?

Thanks again guys

Matt