显示标签为“fixing”的博文。显示所有博文
显示标签为“fixing”的博文。显示所有博文

2012年3月19日星期一

Fixing the Problem

I followed the suggestions of some in this thread but the easiest, and subsequently the one that worked for me, turned out to be simply installing Reporting Services for SQL Server 2000. In my case the registry didn't have the rptproj extention listed so the narrative 'make sure the application for the project type (.rptproj) is installed' made sense to me. After installation class was listed in the registry and Visual Studio 2003 could now see, both files were shown whenever I went to the solution directory, and open the report files. I hope this helps some but it seems there are differing problems tracking the same error message.

Hello Steve_King:

Could you please gives the link about the thread which has the suggestions?

Are SQL Server 2000 and VS 2003 used by Team Foundation Server?

Thank you very much.

Fixing the Problem

I followed the suggestions of some in this thread but the easiest, and subsequently the one that worked for me, turned out to be simply installing Reporting Services for SQL Server 2000. In my case the registry didn't have the rptproj extention listed so the narrative 'make sure the application for the project type (.rptproj) is installed' made sense to me. After installation class was listed in the registry and Visual Studio 2003 could now see, both files were shown whenever I went to the solution directory, and open the report files. I hope this helps some but it seems there are differing problems tracking the same error message.

Hello Steve_King:

Could you please gives the link about the thread which has the suggestions?

Are SQL Server 2000 and VS 2003 used by Team Foundation Server?

Thank you very much.

Fixing Table Headers

Hi,
the problem in one of our reports is, that there are a lot of detail lines
for each group, so if you scroll down to see them, the table header is not
visible. Our customers are complaining about that, because they have to
scroll up and down to see to which field the detail belongs.
Moreover it is not possible to split the table, because all details are a
logical group.
My question: Is it possible to fix a table header like the fixing function
in excel, so it can always be seen when you scroll down the details?
Thanks,
BjörnTable headers can be repeated on each page, but you can not do the excel
like thing... You can make your page smaller, but that's about it I think.
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Björn Grünberg" <BjrnGrnberg@.discussions.microsoft.com> wrote in message
news:DE7380C6-C5A0-47C0-9C0E-F267976BCC4A@.microsoft.com...
> Hi,
> the problem in one of our reports is, that there are a lot of detail lines
> for each group, so if you scroll down to see them, the table header is not
> visible. Our customers are complaining about that, because they have to
> scroll up and down to see to which field the detail belongs.
> Moreover it is not possible to split the table, because all details are a
> logical group.
> My question: Is it possible to fix a table header like the fixing function
> in excel, so it can always be seen when you scroll down the details?
> Thanks,
> Björn|||Wayne is right, Reporting Services 2000 does not this particular feature.
Look for this in Reporting Services 2005 (shipping as part of Yukon),
though.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:uhCnpeBRFHA.3020@.TK2MSFTNGP12.phx.gbl...
> Table headers can be repeated on each page, but you can not do the excel
> like thing... You can make your page smaller, but that's about it I think.
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "Björn Grünberg" <BjrnGrnberg@.discussions.microsoft.com> wrote in message
> news:DE7380C6-C5A0-47C0-9C0E-F267976BCC4A@.microsoft.com...
>> Hi,
>> the problem in one of our reports is, that there are a lot of detail
>> lines
>> for each group, so if you scroll down to see them, the table header is
>> not
>> visible. Our customers are complaining about that, because they have to
>> scroll up and down to see to which field the detail belongs.
>> Moreover it is not possible to split the table, because all details are a
>> logical group.
>> My question: Is it possible to fix a table header like the fixing
>> function
>> in excel, so it can always be seen when you scroll down the details?
>> Thanks,
>> Björn
>|||On Mon, 18 Apr 2005 03:57:19 -0700, "Björn Grünberg"
<BjrnGrnberg@.discussions.microsoft.com> wrote:
>Hi,
>the problem in one of our reports is, that there are a lot of detail lines
>for each group, so if you scroll down to see them, the table header is not
>visible. Our customers are complaining about that, because they have to
>scroll up and down to see to which field the detail belongs.
>Moreover it is not possible to split the table, because all details are a
>logical group.
>My question: Is it possible to fix a table header like the fixing function
>in excel, so it can always be seen when you scroll down the details?
>Thanks,
>Björn
Bjorn,
It's a little bit of a kludge but why not add a table footer and
simply repeat the information that is in the table header? That should
make the relevant information visible in a larger part of the page.
Andrew Watt
MVP - InfoPath

fixing SQL CE Merge replication

Does anyone know of a way to regenerate the system tables that merge
replication uses? A lot of my users are getting blank system tables which
causes native exceptions when I go to sync or reinitialize. The number of
rows that I would stand to lose if I couldn't regenerate these tables is
really unacceptable. On a side note, how are these tables clearing
themselves? Our program doesn't touch any system tables and the db is
password protected to keep users out of it.
Currently, we are creating a new subscription and then inserting the rows
that are in the old database into the new db. The problem with this is that
it takes over an hour per database.
Something is very wrong here. Your merge replication system tables should
have data in them. Especially msmerge_contents, and msmerge_replinfo.
You should call PSS on this one.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Scott Simons" <Scott.Simons.At.MealMagic.Com.Remove.This> wrote in message
news:8D20ADAA-6607-4AEB-A2FE-AF7E2A33DD93@.microsoft.com...
> Does anyone know of a way to regenerate the system tables that merge
> replication uses? A lot of my users are getting blank system tables which
> causes native exceptions when I go to sync or reinitialize. The number of
> rows that I would stand to lose if I couldn't regenerate these tables is
> really unacceptable. On a side note, how are these tables clearing
> themselves? Our program doesn't touch any system tables and the db is
> password protected to keep users out of it.
> Currently, we are creating a new subscription and then inserting the rows
> that are in the old database into the new db. The problem with this is
that
> it takes over an hour per database.

fixing orphan users

Hi All,
I'm trying to fix all the orphans users for all the databases in my sql
server 2000 using the code above, but I'm getting an error that the second
cursor already exist.
Can I do a cursor inside another one?
How can I fix this problem?
Any ideas?
Tks in advance
JFB
DECLARE @.DBName sysname
,@.DBStatus int
,@.dbid int
,@.TempDBName nvarchar(70)
SELECT @.DBName = '*'
SELECT @.TempDBName = ' '
DECLARE DBs CURSOR FOR
SELECT name, dbid, status, name
FROM master..sysdatabases
WHERE [name] <> 'tempdb'
and [name] <> 'master'
and [name] <> 'model'
FOR READ ONLY
OPEN DBs
FETCH NEXT FROM DBs INTO @.DBName, @.dbid, @.DBStatus, @.TempDBName
WHILE @.@.FETCH_STATUS = 0
BEGIN
Print @.TempDBName
DECLARE @.tempString nvarchar(255)
SELECT @.tempString = 'USE ' + @.TempDBName +'
DECLARE @.UserName nvarchar(50)
DECLARE orphanuser_cur cursor for
SELECT UserName = name
FROM sysusers
WHERE issqluser = 1 and (sid is not null and sid <> 0x0) and
suser_sname(sid) is null
ORDER BY name
OPEN orphanuser_cur
FETCH NEXT FROM orphanuser_cur INTO @.UserName
WHILE (@.@.fetch_status = 0)
BEGIN
PRINT @.UserName '' user name being resynced''
EXEC sp_change_users_login ''Update_one'', @.UserName, @.UserName
FETCH NEXT FROM orphanuser_cur INTO @.UserName
END
CLOSE orphanuser_cur
DEALLOCATE orphanuser_cur'
EXEC (@.tempString)
FETCH NEXT FROM DBs INTO @.DBName, @.dbid, @.DBStatus, @.TempDBName
END
CLOSE DBs
DEALLOCATE DBsOn Wed, 16 Feb 2005 18:06:32 -0500, JFB wrote:

>I'm trying to fix all the orphans users for all the databases in my sql
>server 2000 using the code above, but I'm getting an error that the second
>cursor already exist.
>Can I do a cursor inside another one?
>How can I fix this problem?
>Any ideas?
Hi JFB,
The first thing to do when troubleshooting dynamic SQL is to change
EXEC (@.tempString)
to
PRINT @.tempString
and inspect the results.
If you do that, you'll instantly note that the length of your dynamic SQL
exceeds the 255 character you used in the declaration of @.tempString.
Another problem you'll find after fixing this one is here:
> PRINT @.UserName '' user name being resynced''
This should be changed to
PRINT @.UserName + '' user name being resynced''
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Yes Hugo, Tks for you reply and help.
I got those problems...
Rgds
JFB
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:f8v9115l8464ppt54s56bo45knisli5l3u@.
4ax.com...
> On Wed, 16 Feb 2005 18:06:32 -0500, JFB wrote:
>
> Hi JFB,
> The first thing to do when troubleshooting dynamic SQL is to change
> EXEC (@.tempString)
> to
> PRINT @.tempString
> and inspect the results.
> If you do that, you'll instantly note that the length of your dynamic SQL
> exceeds the 255 character you used in the declaration of @.tempString.
> Another problem you'll find after fixing this one is here:
> This should be changed to
> PRINT @.UserName + '' user name being resynced''
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||Yes Hugo, Tks for you reply and help.
I got those problems...
Rgds
JFB
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:f8v9115l8464ppt54s56bo45knisli5l3u@.
4ax.com...
> On Wed, 16 Feb 2005 18:06:32 -0500, JFB wrote:
>
> Hi JFB,
> The first thing to do when troubleshooting dynamic SQL is to change
> EXEC (@.tempString)
> to
> PRINT @.tempString
> and inspect the results.
> If you do that, you'll instantly note that the length of your dynamic SQL
> exceeds the 255 character you used in the declaration of @.tempString.
> Another problem you'll find after fixing this one is here:
> This should be changed to
> PRINT @.UserName + '' user name being resynced''
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)

Fixing my table based on Dbcc Showcontig results

Can someone please help me interpret this result set below and suggest
on way I can speed up my table? What changes should I make?

DBCC SHOWCONTIG scanning 'tblListing' table...
Table: 'tblListing' (1092914965); index ID: 1, database ID: 13
TABLE level scan performed.
- Pages Scanned........................: 97044
- Extents Scanned.......................: 12177
- Extent Switches.......................: 13452
- Avg. Pages per Extent..................: 8.0
- Scan Density [Best Count:Actual Count]......: 90.17% [12131:13453]
- Logical Scan Fragmentation ..............: 0.86%
- Extent Scan Fragmentation ...............: 2.68%
- Avg. Bytes Free per Page................: 1415.8
- Avg. Page Density (full)................: 82.51%
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.

Thank you.You should take a look at ttp://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/ss2kidbp.mspx. Let us know if you have any questions after reading this. Keep in mind that it's quite possible that given your server workload, index defragmentation isn't at all necessary.

Thanks,
Ryan Stonecipher
Microsoft SQL Server Storage Engine.
"SR" <yosonu@.socal.rr.com> wrote in message news:ba4c21f6.0406140740.7de00c3a@.posting.google.c om...
Can someone please help me interpret this result set below and suggest
on way I can speed up my table? What changes should I make?

DBCC SHOWCONTIG scanning 'tblListing' table...
Table: 'tblListing' (1092914965); index ID: 1, database ID: 13
TABLE level scan performed.
- Pages Scanned........................: 97044
- Extents Scanned.......................: 12177
- Extent Switches.......................: 13452
- Avg. Pages per Extent..................: 8.0
- Scan Density [Best Count:Actual Count]......: 90.17% [12131:13453]
- Logical Scan Fragmentation ..............: 0.86%
- Extent Scan Fragmentation ...............: 2.68%
- Avg. Bytes Free per Page................: 1415.8
- Avg. Page Density (full)................: 82.51%
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.

Thank you.|||"SR" <yosonu@.socal.rr.com> wrote in message
news:ba4c21f6.0406140740.7de00c3a@.posting.google.c om...
> Can someone please help me interpret this result set below and suggest
> on way I can speed up my table? What changes should I make?
> DBCC SHOWCONTIG scanning 'tblListing' table...
> Table: 'tblListing' (1092914965); index ID: 1, database ID: 13
> TABLE level scan performed.
> - Pages Scanned........................: 97044
> - Extents Scanned.......................: 12177
> - Extent Switches.......................: 13452
> - Avg. Pages per Extent..................: 8.0
> - Scan Density [Best Count:Actual Count]......: 90.17% [12131:13453]
> - Logical Scan Fragmentation ..............: 0.86%
> - Extent Scan Fragmentation ...............: 2.68%
> - Avg. Bytes Free per Page................: 1415.8
> - Avg. Page Density (full)................: 82.51%
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> Thank you.

http://www.sql-server-performance.c..._showcontig.asp

At first glance, the output seems fine - there is very little fragmentation,
and the scan density is high. If you're having performance issues with this
table, you may want to give some more information. In particular, the CREATE
TABLE and CREATE INDEX statements, plus a query which is performing badly,
and the reason why you believe this table is the problem (eg. the execution
plan for the query).

Simon

Fixing consistency of a MDF file (when detached)

I have a DB that has a torn page error, error 823, and is detached. It
fails when reattaching because of the torn page error. Is there a way to
fix the MDF file when the corresponding DB is not attached to the SQL
server?
Thanks in advance
--
brandyg@.online.microsoft.com [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.AFAIK there is nothing published in public. The best thing you can do is to
contact the PSS.
--
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Brandy Griffin [MSFT]" <brandyg@.online.microsoft.com> wrote in message
news:O4UtMIIWDHA.2256@.TK2MSFTNGP10.phx.gbl...
> I have a DB that has a torn page error, error 823, and is detached. It
> fails when reattaching because of the torn page error. Is there a way to
> fix the MDF file when the corresponding DB is not attached to the SQL
> server?
> Thanks in advance
> --
> brandyg@.online.microsoft.com [MSFT]
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
>

Fixing a slow, brute force set of SQL calls

I've got a huge inefficiency in my code that I'm trying to fix. I'm coding in VB.NET using ASP.NET and an MSSQL 2000 server.

I'm working in a temporary table that has an identical layout as another, non-temporary table in my database. Once I get the temp table how I want it, I need to insert everything from that table into my main table. Before I can do that, however, I need to delete all the records in the main table with certain fields that match a record's fields in the temporary table.

Right now, I have a method that builds one delete statement per record in the temporary table and then runs those statements on the main table. Since I'm dealing with the order of 50,000 records (at least) here, building and sending those statements to the server takes forever.

Is there a way I can accomplish the same thing without building and sending such a huge SQL call to the server? If so, how would I go about doing that?

Thanks in advance for whatever help you can give,
-StarwizMy suggestions would be to use this sort of SQL command:


DELETE
FROM
myTable
INNER JOIN
#myTempTable ON #myTempTable.column1 = myTable.column1 <etc>

Terri|||Wouldn't this delete the records from the temporary table, too?|||No, the FROM clause specifies the table to use for the DELETE statement. Only the records from myTable matching the JOIN condition will be deleted.

Terri|||Okay then...but I can't even run it to see, since I get an error:

With the statement:
Delete from PPC inner join PPCTemp on PPC.searchengine = PPCTemp.searchengine and PPC.[date] = PPCTemp.[date] and PPC.keyword = PPCTemp.keyword

I get the error:
ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'inner'.

Any ideas?|||That's because I gave you the wrong syntax and somewhat incorrect information ;-) The table name also has to follow the DELETE statement, and the table name following the DELETE is the one from which records are deleted:


Delete PPC from PPC inner join PPCTemp on PPC.searchengine = PPCTemp.searchengine and PPC.[date] = PPCTemp.[date] and PPC.keyword = PPCTemp.keyword

You should check out the DELETE topic in SQL Server Books Online for more background information on this topic.

Terri|||With the right syntax, it works great (lol)...a million times faster, too!

Thanks a lot.

Fixing a screwup

After synching a handful of subscribers, I reviewed the data that came back
and realized I forgot to set auto range identity on two tables that required
it. So I dumped the pub, dumped the subscriptions, manually assigned the
identity values to consecutive identities, reset the identity columns to
"not for replication", re-created the publication, then let the subscribers
resynch.
Before anyone goes berserk on manually assigning an identity value, note
that at this time, the identity values on those two tables (at the "end of
the food chain" so to speak) are not being used or keyed to other tables,
but may in the future. Whether a record is 1 or 15 or whatever is
irrelevant, but I want to simply ensure uniqueness for future use.
So, my question is, have I overlooked anything or are there other hidden
potential issues?
Earl,
I'm not too sure what you did. It seems as though you set up a nosync
initialization? Or was it a normal initialization but without automatic
range management?
In one place I worked they would often forget to set the automatic range
management on articles. Rather than reinitializing, which was simply not
possible, what they'd do is reseed the identity value at the subscriber.
There were only 3 subscribers, so there was never a posibility of range
overlaps. The main difference to automatic range management was the absence
of check constraints and no possibility of getting a new range from
MSrepl_identity_range but as the difference between seeds was so large it
would be 200 years or so before a clash occurs.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Paul, it was a normal initialization but without automatic range management.
It's an easy thing to forget, especially if you've had to go through a lot
of contortions massaging the data into shape. The subscribers are PocketPCs,
so it would've been a real PIA to reseed those values. The identity values
back in the pub (once synched) were like this:
1
2
3
...
1
2
3
...
1
2
3
Seemed easier to drop the pub and the subscriptions, then do a manual reseed
of the pub tables (had I not caught it immediately and thus been dealing
with a large number of records, I'm not sure how I would've handled the
situation):
1
2
3
4
5
6
7
8
9
...
Which brings to mind a followup question: If my subscribers had the same
name as their pubs then I could've just created a new publication AND
subscription and just moved on? Thanks for your thoughts!
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:e04BD$vdFHA.892@.tk2msftngp13.phx.gbl...
> Earl,
> I'm not too sure what you did. It seems as though you set up a nosync
> initialization? Or was it a normal initialization but without automatic
> range management?
> In one place I worked they would often forget to set the automatic range
> management on articles. Rather than reinitializing, which was simply not
> possible, what they'd do is reseed the identity value at the subscriber.
> There were only 3 subscribers, so there was never a posibility of range
> overlaps. The main difference to automatic range management was the
> absence of check constraints and no possibility of getting a new range
> from MSrepl_identity_range but as the difference between seeds was so
> large it would be 200 years or so before a clash occurs.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Earl,
"Which brings to mind a followup question: If my subscribers had the same
name as their pubs then I could've just created a new publication AND
subscription and just moved on? Thanks for your thoughts!"
- sorry - I'm probably being a bit thick, but I don't follow this. How can
the subscriber have the same computer name as the publisher, and in what way
would this simplify things?
Rgds,
Paul Ibison (www.replicationanswers.com)
|||Hehe ... merge publication on a PocketPC, subscribers assign their own
subscription name, which I usually just keep as the same name across the
board. I have an input form in my app where the users can enter all of their
replication settings. In this case, once I had reseeded the tables, I
could've just created a new pub and set up auto range management at the same
time. Instead of the users synching to the old pub, they would enter the new
pub and subscription names, tap the synch button (which would create a new
db onboard and download the new pub) and keep on trucking. Perhaps it is me
that is "thick" on this one because that may or may not have worked (maybe
I'll try that next time).
Sorry for not including more about how my app works -- I'm primarily a
developer and not a DBA (although since I spend so much time with SLQ
Server, I decided long ago to go ahead and try to get the MCDBA cert).
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:ehq9zp0dFHA.2212@.TK2MSFTNGP14.phx.gbl...
> Earl,
> "Which brings to mind a followup question: If my subscribers had the same
> name as their pubs then I could've just created a new publication AND
> subscription and just moved on? Thanks for your thoughts!"
> - sorry - I'm probably being a bit thick, but I don't follow this. How can
> the subscriber have the same computer name as the publisher, and in what
> way would this simplify things?
> Rgds,
> Paul Ibison (www.replicationanswers.com)
>

Fixing a messy database after the fact...?

2 questions, actually:

I am new to database design and a lot of things never made any sense to me regarding relationships and such. I have been working on a very large design that started out well enough, but as tables were added a lot of organization fell by the wayside. Now that I am getting closer to the end, I am finding a lot of places where there should be Foreign keys, maybe some triggers, etc (I have the same data item in 5 different places, when it is deleted in one place it must go from all). Assuming that the datatypes and sizes are identical for the duplicated bits of data, can I go about making FK-PK relationships and such now that there is a lot of stuff in the database, or do I have to start from scratch and rebuild the whole thing.

The other question is much more simple:

How do I make multiple rows "unique". I have a primary key, and an identity column, but I can't add a secong primary key, and Enterprise Manager only lets me make 'int' datatypes identity columns. I have tried the "add constraints" but it asks for an expression and I have no idea what the syntax might be.

Any help is appreciated.Try downloading AdventureWorks for SQL Server 2000 from the first link, copy the installation file into Query Analyzer and execute it. It is an 87 table Database using the Peter Chen ERD model. The second is PPT slides with the book used to create it, only 143 pages but it has a lot of sample Catalogs that will make things a little easier for you. The book is dry and abstract. Hope this helps.

http://www.microsoft.com/downloads/details.aspx?familyid=487c9c23-2356-436e-94a8-2bfb66f0abdc&languageid=f49e8428-7071-4979-8a67-3cffcb0c2524&displaylang=en

http://wings.buffalo.edu/mgmt/courses/mgtsand/data.html

Kind regards,
Gift Peddie

Fixing a expression

Hi,
I have the following expression for one of the text boxes in my report:
=Sum(Fields!totallagtime.Value)/Sum(Fields!openduring.Value)
But now if division by 0 occurs, it shows up as 'NaN' when run, I would like
it to show up as 0 if division by zero occurs.
Any suggestions on how this expression can be modified to do this?
ThanksTry this:
= iif(Fields!openduring.Value = 0, 0, Sum(Fields!totallagtime.Value) /
iif(Fields!openduring.Value = 0, 1, Fields!openduring.Value))
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Spencer23" <Spencer23@.discussions.microsoft.com> wrote in message
news:3C67F551-06F3-4185-A3ED-74E56DD31FB9@.microsoft.com...
> Hi,
> I have the following expression for one of the text boxes in my report:
> =Sum(Fields!totallagtime.Value)/Sum(Fields!openduring.Value)
> But now if division by 0 occurs, it shows up as 'NaN' when run, I would
like
> it to show up as 0 if division by zero occurs.
> Any suggestions on how this expression can be modified to do this?
> Thanks
>|||=Iif(sum(Fields!openduring.Value)=0,0,Sum(Fields!totallagtime.Value)/Sum(Fie
lds!openduring.Value))
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Spencer23" <Spencer23@.discussions.microsoft.com> wrote in message
news:3C67F551-06F3-4185-A3ED-74E56DD31FB9@.microsoft.com...
> Hi,
> I have the following expression for one of the text boxes in my report:
> =Sum(Fields!totallagtime.Value)/Sum(Fields!openduring.Value)
> But now if division by 0 occurs, it shows up as 'NaN' when run, I would
like
> it to show up as 0 if division by zero occurs.
> Any suggestions on how this expression can be modified to do this?
> Thanks
>|||Hey Rebert,
Could you explain to me what this is doing in english becaue I have never
used iff before and I am not sure what it is doing.
Thanks
"Robert Bruckner [MSFT]" wrote:
> Try this:
> = iif(Fields!openduring.Value = 0, 0, Sum(Fields!totallagtime.Value) /
> iif(Fields!openduring.Value = 0, 1, Fields!openduring.Value))
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Spencer23" <Spencer23@.discussions.microsoft.com> wrote in message
> news:3C67F551-06F3-4185-A3ED-74E56DD31FB9@.microsoft.com...
> > Hi,
> >
> > I have the following expression for one of the text boxes in my report:
> >
> > =Sum(Fields!totallagtime.Value)/Sum(Fields!openduring.Value)
> >
> > But now if division by 0 occurs, it shows up as 'NaN' when run, I would
> like
> > it to show up as 0 if division by zero occurs.
> >
> > Any suggestions on how this expression can be modified to do this?
> >
> > Thanks
> >
>
>|||Thanks Wayne
"Wayne Snyder" wrote:
> =Iif(sum(Fields!openduring.Value)=0,0,Sum(Fields!totallagtime.Value)/Sum(Fie
> lds!openduring.Value))
>
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Spencer23" <Spencer23@.discussions.microsoft.com> wrote in message
> news:3C67F551-06F3-4185-A3ED-74E56DD31FB9@.microsoft.com...
> > Hi,
> >
> > I have the following expression for one of the text boxes in my report:
> >
> > =Sum(Fields!totallagtime.Value)/Sum(Fields!openduring.Value)
> >
> > But now if division by 0 occurs, it shows up as 'NaN' when run, I would
> like
> > it to show up as 0 if division by zero occurs.
> >
> > Any suggestions on how this expression can be modified to do this?
> >
> > Thanks
> >
>
>|||IIF is a function call which essentially gives you similar functionality as
an IF statement - however since IIF is a function it will evaluate all
arguments before it is invoked. Therefore you have to avoid divisions by
zero also in the arguments of the IIF function. This makes it necessary to
write the expression as shown in my previous posting.
More information on IIF is available on MSDN:
http://msdn.microsoft.com/library/en-us/vblr7/html/vafctiif.asp
Among others, all the following VB.NET runtime functions are available for
writing expression in Reporting Services:
http://msdn.microsoft.com/library/en-us/vblr7/html/vaoriVBRuntimeLibraryKeywords.asp
Hope this helps,
Robert
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Spencer23" <Spencer23@.discussions.microsoft.com> wrote in message
news:71BEBB45-521A-4FAC-8D3F-65245709A897@.microsoft.com...
> Hey Rebert,
> Could you explain to me what this is doing in english becaue I have never
> used iff before and I am not sure what it is doing.
> Thanks
> "Robert Bruckner [MSFT]" wrote:
> > Try this:
> > = iif(Fields!openduring.Value = 0, 0, Sum(Fields!totallagtime.Value) /
> > iif(Fields!openduring.Value = 0, 1, Fields!openduring.Value))
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Spencer23" <Spencer23@.discussions.microsoft.com> wrote in message
> > news:3C67F551-06F3-4185-A3ED-74E56DD31FB9@.microsoft.com...
> > > Hi,
> > >
> > > I have the following expression for one of the text boxes in my
report:
> > >
> > > =Sum(Fields!totallagtime.Value)/Sum(Fields!openduring.Value)
> > >
> > > But now if division by 0 occurs, it shows up as 'NaN' when run, I
would
> > like
> > > it to show up as 0 if division by zero occurs.
> > >
> > > Any suggestions on how this expression can be modified to do this?
> > >
> > > Thanks
> > >
> >
> >
> >