Showing posts with label developing. Show all posts
Showing posts with label developing. Show all posts

Tuesday, February 14, 2012

Business Rules -> Using Lots of UDFs & Views

I am in the process of building my first "large scale" database system (after 15+ years of developing Windows Apps and Web Apps) - so I am very VERY "Green" when it comes to Database development & SQL et al.

A little context setting: I am building a multi-tier Statistical Analysis & Reporting system where the "end product" will be Reports created in Reporting Services. There are a ton of business rules that I am implementing in a Business Logic Tier (hidden from the "end user" by a Data Access Tier) comprised of SQL in the form of UDFs (scalar) and Views.

The question: I have been reading that UDFs cause a performance hit compared to things like in-line functions. Alot of the Rules (implemented as Scalar UDFs) build on each other so that the output of UDF #1 is used as input to UDF #2.

So far I am implementing the Business Logic as a hierarchy of Views (7 Views to be exact) with each view implementing multiple Rules; each Rule basically a Scalar UDF. Below is an example of what I am doing:

Example

View #1 -> Select A, B, C, funcX1(A) as ValueX1, funcY1(B, C) as ValueY1 FROM someView

Then

View #2 -> Select A, B, C, ValueX1, ValueY1, funcX2 (ValueX1) as ValueX2, funcY2(ValueY2) as ValueY2 FROM View#1

Currently I have a hierarchy of 7 views that each use UDFs to implement the Business Rules, where the value calculated from a UDF in one View is used as input to UDF in a View further down the Hierarchy.

Is there a better way of implementing all of the Rules instead of using multiple Views with a bunch of UDFs?

The "end product" dataset is then exposed as a Stored Procedure to the reports in Reporting Services.

Any help would be GREATLY appreciated.

Thanks!
- marty

You can make View #1 -> Select A, B, C, funcX1(A) as ValueX1, funcY1(B, C) as ValueY1 FROM someView
and

View #2 -> Select A, B, C, ValueX1, ValueY1, funcX2 (ValueX1) as ValueX2, funcY2(ValueY2) as ValueY2 FROM View#1

as indexed views (if your func's are deterministic ) that will improve performance

see Books Online (look for "indexed views")

To the other part I see a reccurence in building your views; another new feature of SQL 2005 is "common table expressions" that can permit creating recursive queries (look Books Online for "common table expressions" )

|||

Hi!

Well it seems you already got an answer, but here something I would like to add:

For business rules:

use 3NF design (or dw design), use constraints (fk, check constraints, uk/indexes) whenever possible

and use stored procedures as access layer (when not using dw design).

With stored procedures as layer between you highly control access and have freedom to change

your implementation (table design) behind the scenes without breaking code.

This comes escpecially useful, when you have to solve performance problems!

|||You guys Rock!

Using a CTE works like a charm! Using a CTE in a View allows me to use the output of 1 function as input to a 2nd function within the same View.

I am I'm now looking into Indexed Views to see about improving the performance of my Business Rules.

Thanks Again!

Sunday, February 12, 2012

Business Intelligence option disappeared from Visual Studio

I am in the process of evaluating Reporting Services for my company. I
succesfully installed Reporting Services and began developing a simple
report. After closing Visual Studio to attend to another matter, I later
re-opened Visual Studio and was unable to edit my existing report project.
The error I received was "The selected file is not a valid Visual Studio
Solution file". Further, when I tried to create a new project, Business
Intelligence is no longer listed in the project types dialog. I have tried
uninstalling and reinstalling both Visual Studio and Reporting Services and I
still have the same problem. Can anyone suggest a solution? Thank you.Similar problem for me. I installed RS client side and also have no
visibility to BI in VS .NET 2003. A couple of differences though:
1) I -never- had visibility
2) I can open the sample solution file (with the AdventureWorks reports),
and can even deploy it the server. But trying to add new BI items (or create
a BI project to begin with) are impossible.
Can anyone help us?
"Dan Friauf" wrote:
> I am in the process of evaluating Reporting Services for my company. I
> succesfully installed Reporting Services and began developing a simple
> report. After closing Visual Studio to attend to another matter, I later
> re-opened Visual Studio and was unable to edit my existing report project.
> The error I received was "The selected file is not a valid Visual Studio
> Solution file". Further, when I tried to create a new project, Business
> Intelligence is no longer listed in the project types dialog. I have tried
> uninstalling and reinstalling both Visual Studio and Reporting Services and I
> still have the same problem. Can anyone suggest a solution? Thank you.|||Can you check that the folder %ProgramFiles%\Microsoft SQL
Server\80\Tools\Report Designer\Business Intelligence Projects exists? It
should contain 3 files. Next, check for the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\NewProjectTemplates\T
emplateDirs\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\1. It should have 3
values:
(Default) = '#200'
SortPriorty = d '1'
TemplatesDir = 'C:\Program Files\Microsoft SQL Server\80\Tools\Report
Designer\Business Intelligence Projects'
--
Albert Yen
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"J Noble" <J Noble@.discussions.microsoft.com> wrote in message
news:F30A0356-D4E4-4AA9-A279-537D38E4C29E@.microsoft.com...
> Similar problem for me. I installed RS client side and also have no
> visibility to BI in VS .NET 2003. A couple of differences though:
> 1) I -never- had visibility
> 2) I can open the sample solution file (with the AdventureWorks reports),
> and can even deploy it the server. But trying to add new BI items (or
create
> a BI project to begin with) are impossible.
> Can anyone help us?
> "Dan Friauf" wrote:
> > I am in the process of evaluating Reporting Services for my company. I
> > succesfully installed Reporting Services and began developing a simple
> > report. After closing Visual Studio to attend to another matter, I
later
> > re-opened Visual Studio and was unable to edit my existing report
project.
> > The error I received was "The selected file is not a valid Visual Studio
> > Solution file". Further, when I tried to create a new project, Business
> > Intelligence is no longer listed in the project types dialog. I have
tried
> > uninstalling and reinstalling both Visual Studio and Reporting Services
and I
> > still have the same problem. Can anyone suggest a solution? Thank you.|||Yes to both items. I presume that means you think it ought to be working.
Any other thoughts?
Thank you for your assistance.
"Albert Yen [MSFT]" wrote:
> Can you check that the folder %ProgramFiles%\Microsoft SQL
> Server\80\Tools\Report Designer\Business Intelligence Projects exists? It
> should contain 3 files. Next, check for the registry key
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\NewProjectTemplates\T
> emplateDirs\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\1. It should have 3
> values:
> (Default) = '#200'
> SortPriorty = d '1'
> TemplatesDir = 'C:\Program Files\Microsoft SQL Server\80\Tools\Report
> Designer\Business Intelligence Projects'
> --
> Albert Yen
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "J Noble" <J Noble@.discussions.microsoft.com> wrote in message
> news:F30A0356-D4E4-4AA9-A279-537D38E4C29E@.microsoft.com...
> > Similar problem for me. I installed RS client side and also have no
> > visibility to BI in VS .NET 2003. A couple of differences though:
> > 1) I -never- had visibility
> > 2) I can open the sample solution file (with the AdventureWorks reports),
> > and can even deploy it the server. But trying to add new BI items (or
> create
> > a BI project to begin with) are impossible.
> >
> > Can anyone help us?
> >
> > "Dan Friauf" wrote:
> >
> > > I am in the process of evaluating Reporting Services for my company. I
> > > succesfully installed Reporting Services and began developing a simple
> > > report. After closing Visual Studio to attend to another matter, I
> later
> > > re-opened Visual Studio and was unable to edit my existing report
> project.
> > > The error I received was "The selected file is not a valid Visual Studio
> > > Solution file". Further, when I tried to create a new project, Business
> > > Intelligence is no longer listed in the project types dialog. I have
> tried
> > > uninstalling and reinstalling both Visual Studio and Reporting Services
> and I
> > > still have the same problem. Can anyone suggest a solution? Thank you.
>
>|||The folder does exist and the registry values are as given. Although, the
SortPriority is show in hexadecimal rather than decimal. Where do we go from
here?
"Albert Yen [MSFT]" wrote:
> Can you check that the folder %ProgramFiles%\Microsoft SQL
> Server\80\Tools\Report Designer\Business Intelligence Projects exists? It
> should contain 3 files. Next, check for the registry key
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\NewProjectTemplates\T
> emplateDirs\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\1. It should have 3
> values:
> (Default) = '#200'
> SortPriorty = d '1'
> TemplatesDir = 'C:\Program Files\Microsoft SQL Server\80\Tools\Report
> Designer\Business Intelligence Projects'
> --
> Albert Yen
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "J Noble" <J Noble@.discussions.microsoft.com> wrote in message
> news:F30A0356-D4E4-4AA9-A279-537D38E4C29E@.microsoft.com...
> > Similar problem for me. I installed RS client side and also have no
> > visibility to BI in VS .NET 2003. A couple of differences though:
> > 1) I -never- had visibility
> > 2) I can open the sample solution file (with the AdventureWorks reports),
> > and can even deploy it the server. But trying to add new BI items (or
> create
> > a BI project to begin with) are impossible.
> >
> > Can anyone help us?
> >
> > "Dan Friauf" wrote:
> >
> > > I am in the process of evaluating Reporting Services for my company. I
> > > succesfully installed Reporting Services and began developing a simple
> > > report. After closing Visual Studio to attend to another matter, I
> later
> > > re-opened Visual Studio and was unable to edit my existing report
> project.
> > > The error I received was "The selected file is not a valid Visual Studio
> > > Solution file". Further, when I tried to create a new project, Business
> > > Intelligence is no longer listed in the project types dialog. I have
> tried
> > > uninstalling and reinstalling both Visual Studio and Reporting Services
> and I
> > > still have the same problem. Can anyone suggest a solution? Thank you.
>
>|||OK. I'm feeling real foolish here. When I upgraded to Visual Studio 2003
the upgrade did not remove the start menu option for the previous version. I
was starting "Microsoft Visual Studio .NET" and not "Microsoft Visual Studio
.NET 2003". When I open the right one, everything is there.
"Dan Friauf" wrote:
> The folder does exist and the registry values are as given. Although, the
> SortPriority is show in hexadecimal rather than decimal. Where do we go from
> here?
> "Albert Yen [MSFT]" wrote:
> > Can you check that the folder %ProgramFiles%\Microsoft SQL
> > Server\80\Tools\Report Designer\Business Intelligence Projects exists? It
> > should contain 3 files. Next, check for the registry key
> > HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\NewProjectTemplates\T
> > emplateDirs\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\1. It should have 3
> > values:
> > (Default) = '#200'
> > SortPriorty = d '1'
> > TemplatesDir = 'C:\Program Files\Microsoft SQL Server\80\Tools\Report
> > Designer\Business Intelligence Projects'
> >
> > --
> > Albert Yen
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> > "J Noble" <J Noble@.discussions.microsoft.com> wrote in message
> > news:F30A0356-D4E4-4AA9-A279-537D38E4C29E@.microsoft.com...
> > > Similar problem for me. I installed RS client side and also have no
> > > visibility to BI in VS .NET 2003. A couple of differences though:
> > > 1) I -never- had visibility
> > > 2) I can open the sample solution file (with the AdventureWorks reports),
> > > and can even deploy it the server. But trying to add new BI items (or
> > create
> > > a BI project to begin with) are impossible.
> > >
> > > Can anyone help us?
> > >
> > > "Dan Friauf" wrote:
> > >
> > > > I am in the process of evaluating Reporting Services for my company. I
> > > > succesfully installed Reporting Services and began developing a simple
> > > > report. After closing Visual Studio to attend to another matter, I
> > later
> > > > re-opened Visual Studio and was unable to edit my existing report
> > project.
> > > > The error I received was "The selected file is not a valid Visual Studio
> > > > Solution file". Further, when I tried to create a new project, Business
> > > > Intelligence is no longer listed in the project types dialog. I have
> > tried
> > > > uninstalling and reinstalling both Visual Studio and Reporting Services
> > and I
> > > > still have the same problem. Can anyone suggest a solution? Thank you.
> >
> >
> >|||No, I don't have any ideas why you cannot see "Business Intelligence
Projects" in the New Project dialog. However, since you say you can open
existing projects, you can create a new one by coping the template file.
%ProgramFiles%\\Microsoft SQL Server\80\Tools\Report
Designer\ReportProjects\ReportProject.rptproj and opening that.
--
Albert Yen
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"J Noble" <JNoble@.discussions.microsoft.com> wrote in message
news:650FBF6D-2F9E-4647-9CAD-C30D3F2D2B61@.microsoft.com...
> Yes to both items. I presume that means you think it ought to be working.
> Any other thoughts?
> Thank you for your assistance.
>
> "Albert Yen [MSFT]" wrote:
> > Can you check that the folder %ProgramFiles%\Microsoft SQL
> > Server\80\Tools\Report Designer\Business Intelligence Projects exists?
It
> > should contain 3 files. Next, check for the registry key
> >
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\NewProjectTemplates\T
> > emplateDirs\{4a0c6509-bf90-43da-abee-0aba3a8527f1}\1. It should have 3
> > values:
> > (Default) = '#200'
> > SortPriorty = d '1'
> > TemplatesDir = 'C:\Program Files\Microsoft SQL Server\80\Tools\Report
> > Designer\Business Intelligence Projects'
> >
> > --
> > Albert Yen
> > SQL Server Reporting Services
> >
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> > "J Noble" <J Noble@.discussions.microsoft.com> wrote in message
> > news:F30A0356-D4E4-4AA9-A279-537D38E4C29E@.microsoft.com...
> > > Similar problem for me. I installed RS client side and also have no
> > > visibility to BI in VS .NET 2003. A couple of differences though:
> > > 1) I -never- had visibility
> > > 2) I can open the sample solution file (with the AdventureWorks
reports),
> > > and can even deploy it the server. But trying to add new BI items (or
> > create
> > > a BI project to begin with) are impossible.
> > >
> > > Can anyone help us?
> > >
> > > "Dan Friauf" wrote:
> > >
> > > > I am in the process of evaluating Reporting Services for my company.
I
> > > > succesfully installed Reporting Services and began developing a
simple
> > > > report. After closing Visual Studio to attend to another matter, I
> > later
> > > > re-opened Visual Studio and was unable to edit my existing report
> > project.
> > > > The error I received was "The selected file is not a valid Visual
Studio
> > > > Solution file". Further, when I tried to create a new project,
Business
> > > > Intelligence is no longer listed in the project types dialog. I
have
> > tried
> > > > uninstalling and reinstalling both Visual Studio and Reporting
Services
> > and I
> > > > still have the same problem. Can anyone suggest a solution? Thank
you.
> >
> >
> >