Today, for the second time since we started using SSRS 2008 I had the following stupid error:
Running a dataset works from VS designed, but when I try to run the report (again, from the VS2008 designer) I get errors (DS couldn't be run)
After little investigation I realize that the problem is in fact that the report cannot be built. I had VS2008 access to RDS file denied. this is not a read-only file, is checked-out, so VS should be able to access the file and change it.
However, VS keeps telling that access to {MyReportsFolder}\bin\Debug\{MyDataSource.rds} is denied
The only way I found to fix this was to delete the folder {MyReportsFolder}\bin and rebuild.
Weird...
Wednesday, May 4, 2011
Sometimes VS 2008 cannot access DataSource file
Posted by
Radu
at
7:22 AM
0
comments
Friday, January 14, 2011
Error in SSIS VS2005
Yesterday I had to put some code into SSIS packages.
Being a lazy person, what I usually do is copying one of the existing task ("Execute SQL Task") and changing the name and the code itself. Apparently after installing VS2005 SP1 this was not working anymore.
I had to create every "Execute SQL Task", set the connection, etc....which is not a lot but is slower than what I was used to.
The error message I was receiving while trying to copy was "An error occurred while objects were being copied. SSIS Designer could not serialize the SSIS runtime objects". A fast google search revealed this page and the easy fix by jaegd:
Register the xml parser dlls with the below commands.
regsvr32.exe msxml3.dll
regsvr32.exe msxml6.dll
It really worked and fixed my problem, but lets me wondering why Microsoft didn't fix it and release a SP2 with all this fixes.
Posted by
Radu
at
1:10 AM
0
comments
Labels: SSIS, VisualStudio
Wednesday, October 6, 2010
Find the Last Apparition of a Value in String
set @a = 'ssss$kkkk$ooooo$abcde'
Update: Of course, using it to trim out the last part of the string is going to be something like this:
Posted by
Radu
at
9:51 AM
0
comments
Labels: SQL Server 2005, string
Wednesday, September 22, 2010
SSRS. Must declare scalar variable @Parameter1
This can be pretty annoying especially when you know you have the report parameter and it used to work. What happens is that, due to some black magic that I cannot explain, the data source is loosing the list of parameters. So the fix is to either add the parameters one by one or just delete and recreate the data source and everything will work.
Posted by
Radu
at
2:03 AM
2
comments
Wednesday, September 8, 2010
ROLLUP vs CUBE
Well, that's what happen when you don't carefully read the documentation. I have recently discovered the benefit of the WITH ROLLUP clause in SQLServer 2005, and I thought what it was doing was returning all possible combinations of grouping.
Wrong, that's the WITH CUBE.
Using the WITH ROLLUP I found out that the number of rows returned by my query was dependent on the order of the fields in the group by clause. Funny.
Well, to keep it short, I found this: http://msdn.microsoft.com/en-us/library/ms189305%28SQL.90%29.aspx
because "ROLLUP generates a result set that shows aggregates for a hierarchy of values in the selected columns" we get results depending on this hierarchy.
unlike it, what I needed was the WITH CUBE clause: CUBE generates a result set that shows aggregates for all combinations of values in the selected columns.
Posted by
Radu
at
8:04 AM
0
comments
Labels: cube, rollup, SQL Server 2005
Monday, November 9, 2009
Visual Studio vs ReportingService
Posted by
Radu
at
12:57 PM
0
comments
Labels: report, VisualStudio
Monday, March 30, 2009
Visual Studio Editor
While working on a web site recently, I used Visual Studio 2008 for a small wizard in ASP.NET.
It was cool at the beginning, but it become really painful when, after a while, I was trying to update the tables on the page. Seems like Visual Studio is creating a lot of stupid style-sheets when you drag the table's rows or columns. Hilarious things, like very height rows of the tables, happen. When you try to resize the row back to it's normal size, no way. The only way I found was to manually edit the ASPX and delete the generated styles. And I'm not the only one having problems with it, a friend whom I am working with reported the same problem.
While I like Visual Studio for it's ease of use and clean interface, I found the way it deals with the wizard to be very...let's say at least uninspired. So, what can be done ?
1) Integrate really often, so if the things get messed up you can come back to a good version.
2) Manually edit the ASPX for small changes. It's much faster than trying to convince VS to work the way you'd expect.
Posted by
Radu
at
10:32 AM
0
comments
Labels: ASP.NET, VisualStudio
Wednesday, January 14, 2009
Don't get over OVER
So I knew about over but didn't have the opportunity to use it every day. But today, I needed a query that would group the data by two criteria; for each group I have a number and then for each group I need the row with that number to be the MAX in the group by first criteria.
Like this: I have table T with Columns A, B and theNumber and I do a
SELECT A,b, sum(theNumber)
FROM T
GROUP BY A, B
And from this I need the rows with the max sum(theNumber) per A
That resulted into
SELECT A, min(B), theNb FROM (
SELECT A, B, theNb, MAX(theNb) OVER (PARTITION BY A) maxim
FROM (
SELECT A,B, sum(thenumber) as theNb FROM T
WHERE someCondition
GROUP BY A, B) aa
) bb
WHERE theNb= maxim
instead of big subQueries and clumsy code
Posted by
Radu
at
5:06 AM
0
comments
Labels: ORDER, SQL Server
Thursday, November 13, 2008
Be Discrete
Well, sometimes being discreet is being efficient :)
I recently had to optimize some reports for speed and I found one query that took around 8 seconds.
The query, a pretty simple select was doing
SELECT blah, blah
FROM theTable
WHERE Year <= @Year
AND Year > @Year - 10
What I did was using the ugly, but efficient
SELECT blah, blah
FROM theTable
WHERE Year IN (@Year-9, @Year-8, @Year-7, @Year-6, @Year-5, @Year-4, @Year-3, @Year-2, @Year-1, @Year)
The execution time dropped from 8 seconds to about 900 ms.
Posted by
Radu
at
3:07 AM
0
comments
Labels: optimizing, SQL Server
Tuesday, October 7, 2008
UNPIVOT SQL SERVER OPTION
Sometimes reading about new features of the products you are using help a lot.
Using UNPIVOT I managed to reduce the length of a query from 8 seconds to about 650 - 700 ms.
The old query was doing a UNION between data based on data from some columns. The initial Query was doing this (data changed for privacy reasons):
SELECT country , year , SUM(cases) AS nbCases , isNotValidSomething , isValidSomething , 'some stuff' AS ResultType , 1 AS SortOrder , CASE Column01 WHEN 'S' THEN Sum (cases) ELSE 0 END AS Sensitive, CASE Column01 WHEN 'R' THEN Sum (cases) ELSE 0 END AS Resistant, CASE Column01 WHEN 'Unk' THEN SUM (cases) ELSE 0 END AS Unknown FROM vAll WHERE Country = @Country AND Year =@Year AND Column01 IS NOT NULL GROUP BY country, year, isNotValidSomething, isValidSomething , Column01 , rType UNION SELECT country , year , SUM(cases) AS nbCases , isNotValidSomething , isValidSomething , 'some other stuff' AS ResultType , 2 AS SortOrder ,CASE Column02 WHEN 'S' THEN Sum (cases) ELSE 0 END AS Sensitive, CASE Column02 WHEN 'R' THEN Sum (cases) ELSE 0 END AS Resistant, CASE Column02 WHEN 'Unk' THEN SUM (cases) ELSE 0 END AS Unknown FROM vAll WHERE Country = @Country AND Year =@Year AND Column01 IS NOT NULL GROUP BY country, year, isNotValidSomething, isValidSomething , Column02, rType UNION .... (there are 8 queries like this in UNION)
The new query is doing :
SELECT country, year
, SUM(cases) AS nbCases
, isNotValidSomething, isValidSomething, ID, Cols FROM vAll
UNPIVOT (
ID FOR Cols in ( Column01
,Column02
,Column03
,Column04
,Column05
,Column06
,Column07
,Column08
)
) up
WHERE country = @Country
AND year = @Year
GROUP BY country, year, isNotValidSomething, isValidSomething, up.ID, Cols
ORDER BY country, year desc, Cols
Thanks to this post.
All best,
Radu
Posted by
Radu
at
5:19 AM
1 comments
Labels: Performance, SQL Server 2005, UNPIVOT