Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Friday, March 23, 2012

Finding a line number

I have a large query that I am trying to debug in query analyzer.
However, the errors I get have no line number or reference to where
they are failing. How can I find out what line in the query is causing
a particular error message to appear?

Thanks
John Ivey
South Pike School Districtjohnivey@.gmail.com wrote:

Quote:

Originally Posted by

I have a large query that I am trying to debug in query analyzer.
However, the errors I get have no line number or reference to where
they are failing. How can I find out what line in the query is causing
a particular error message to appear?
>
Thanks
John Ivey
South Pike School District


What is the error message?

Try simplifying the query until it works. Exactly where to start
depends on just what the error message is.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--|||(johnivey@.gmail.com) writes:

Quote:

Originally Posted by

I have a large query that I am trying to debug in query analyzer.
However, the errors I get have no line number or reference to where
they are failing. How can I find out what line in the query is causing
a particular error message to appear?


Errors usually come with a line number, and you can double-click on
the error message and be taken to the troublesome line.

Unfortunately, though, SQL Server's reporting of line numbers is often
inaccurate. Some errors are reported on the statement following the
statement with the error. If your error is incorrect column name or
table name, SQL Server will only point to where the query starts, which
is not very helpful for a 50-line query. (SQL 2005 does actually report
the exact line number in some of these situations, but not all.)

And if the error occurs during execution of the query, it's not really
sure that it would be meaningful with a line number within the query,
as the query is not processed line by line.

What error message do you get?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Monday, March 12, 2012

Find out if a row is subtotal or not?

How do I check if a row is a subtotal or not? I have a report where one
column shows Average hour rate. Right now, the subtotal line shows the
Average column as a subtotal of all the other averages... So I'd like to
have a statement that does something like
if row is a subtitle row then
show nothing (or something else)
else
show the Average value
end if
I bet it's trivial, but I can't figure it out. Please help. :)
Kaisa M. LindahlDid you look at the InScope function? It will allow you to distinguish
between cells in subtotals and cells in the groupings. More information on
InScope is available at:
http://msdn.microsoft.com/library/en-us/RSCREATE/htm/rcr_creating_expressions_v1_0jmt.asp
E.g. =iif(InScope("ColumnGroup"), Avg(Fields!F1.Value), Nothing)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kaisa M. Lindahl" <kaisaml@.hotmail.com> wrote in message
news:%23glpsPj1EHA.3468@.TK2MSFTNGP14.phx.gbl...
> How do I check if a row is a subtotal or not? I have a report where one
> column shows Average hour rate. Right now, the subtotal line shows the
> Average column as a subtotal of all the other averages... So I'd like to
> have a statement that does something like
> if row is a subtitle row then
> show nothing (or something else)
> else
> show the Average value
> end if
> I bet it's trivial, but I can't figure it out. Please help. :)
> Kaisa M. Lindahl
>