Showing posts with label logic. Show all posts
Showing posts with label logic. Show all posts

Monday, March 26, 2012

Poison Message Sample in BOL

Hello Remus,

I have implemented Event Notification sample you provided in my logic, but I am perplexed that even though my watched queue does go down, I do not get message in the Event_Collector queue all the time. The Event_Collector queue does stay enabled though. Any thoughts? I guess any suggestions on debugging the event notification portion would be helpful.

Lubomir
Upon further look at the sys.event_notifications view, I discovered that my event notification is not there any more - it disappears. So the first time the queue goes down, the notification is successful and the Event Notification is still in sys.event_notifications. Second attemp removes the Event Notification from sys.event_notifications.

Lubomir|||

Can you check if the event notification infrastructure isn't receving back an error or an end dialog message on the system dialog that delivers the notifications? Look into errorlog or in Event Viewer (Application), see if you find a record similar to one of these:

Event notification conversation on dialog handle '{4B086B77-C691-DA11-AD12-00030D303B72}' closed without an error.

or:

Closed event notification conversation endpoint with handle '{B1663957-C791-DA11-AD12-00030D303B72}', due to the following error: '<?xml version="1.0"?><Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-8494</Code><Description>You do not have permission to access the service &apos;s&apos;.</Description></Error>'.

HTH,
~ Remus

|||Thank you Remus,

Yup it was the End Dialog message I had; Things work great now.

Lubomir

Monday, February 20, 2012

Please help, Dynamic search stored proc.

Please help, I am trying to write a dynamic search stored procedure using three fields.
I use the same logic on the front end using VB to SQL server which works fine, but never tried a stored procedure with the logic.
Can you please help me, construct a stored procedure.
User can choose any of the three(progno, projno, contractno) fields as a where condition.

I ma using asp.net as front end with sql server backend.


CREATE PROCEDURE dbo.USP_Searchrecords
(@.ProgNO nvarchar(50),
@.ProjNOnvarchar(50) ,
@.ContractNOnvarchar(50))
AS
DECLARE @.myselect nvarchar(2000)
DECLARE @.psql nvarchar(2000)
DECLARE @.strsql nvarchar(2000)
SET NOCOUNT ON

@.psql = "SELECT * FROM Mytable"

IF @.ProgNO <> '' then
strsql = WHERE ProgNO = @.ProgNO
end if

If @.ProjNO <> '' then
if strsql <> '' then
strsql = strsql & " and ProjNO =@.ProjNO
ELSE
strsql = wHERE ProjNO =@.ProjNO
END IF
END IF

If @.ContractNO <> '' then
if strsql <> '' then
strsql = strsql & " and ContractNO =@.ContractNO
ELSE
strsql = wHERE ContractNO =@.ContractNO
END IF
END IF

@.myselect = @.psql + @.strsql

EXEC(@.myselect)

Please help. Thank you very much.CREATE PROCEDURE dbo.USP_Searchrecords

@.ProgNO nvarchar(50) = null,
@.ProjNOnvarchar(50) = null ,
@.ContractNOnvarchar(50) = null

AS
select * from mytable
where
(
((@.ProgNO is null) or (progNo = @.ProgNO))
AND
((@.ProjNO is null) or (ProjNo = @.ProjNO))
AND
((@.ContractNO is null) or (ContractNo = @.ContractNO))
)|||Do NOT do this.

::CREATE PROCEDURE dbo.USP_Searchrecords

should have a WITH RECOMPILE option here.

Problem is: Depending on the parameters you will get totally different access paths. Without indicating these should be evaluated EVERY TIME, the FIRST access path will be reused, EVEN if it is totally ridiculous given the exact parameters. This will result in awfully slow queries.|||>>should have a WITH RECOMPILE option here

Thona points out a great reason NOT to use Dynamic SQL if you dont have to.

Having an sp precompiled is one of the main performance benefits of using stored procedures - Unless you make changes to the table structure, introduce new indexes, or use Dynamic SQL you should'nt need to recompile your stored procedures.

Please help! Report Builder model from UDM?

This is my second posting. Please help!
Hello,
I have created a cube in Analysis Services and made many business logic
changes in the Data Source View and dimensions. Can I use this to build
a model for the Report builder? I believe they call this UDM? People will
create ad-hoc reports in report builder.
I know I can use the UDM to create reports in VS.
Thank youto generate a report builder model based on an Analysis Database.
Simply go on the reports web site (http://localhost/reports)
create a new connection to your AS server
click "generate model"
and you have a model based on your OLAP cubes.
Also,
you can create your own model based on the DSV, this model will execute SQL
statements against your source database instead of using the AS server and
MDX statements.
but you have some manual work to do to insure that the model works fine for
your needs. in another hand you have a better control of what you'll display
to the end users (by playing with detailed property)
"ystueker" <ystueker@.discussions.microsoft.com> wrote in message
news:7E96DAE4-F823-4160-A7C1-C8D45772EE6B@.microsoft.com...
> This is my second posting. Please help!
> Hello,
> I have created a cube in Analysis Services and made many business logic
> changes in the Data Source View and dimensions. Can I use this to build
> a model for the Report builder? I believe they call this UDM? People will
> create ad-hoc reports in report builder.
> I know I can use the UDM to create reports in VS.
> Thank you
>|||Thank you. I have tried that but my option for generate model is grayed out'
"Jéjé" wrote:
> to generate a report builder model based on an Analysis Database.
> Simply go on the reports web site (http://localhost/reports)
> create a new connection to your AS server
> click "generate model"
> and you have a model based on your OLAP cubes.
> Also,
> you can create your own model based on the DSV, this model will execute SQL
> statements against your source database instead of using the AS server and
> MDX statements.
> but you have some manual work to do to insure that the model works fine for
> your needs. in another hand you have a better control of what you'll display
> to the end users (by playing with detailed property)
> "ystueker" <ystueker@.discussions.microsoft.com> wrote in message
> news:7E96DAE4-F823-4160-A7C1-C8D45772EE6B@.microsoft.com...
> > This is my second posting. Please help!
> >
> > Hello,
> > I have created a cube in Analysis Services and made many business logic
> > changes in the Data Source View and dimensions. Can I use this to build
> > a model for the Report builder? I believe they call this UDM? People will
> > create ad-hoc reports in report builder.
> >
> > I know I can use the UDM to create reports in VS.
> >
> > Thank you
> >
>
>|||mmm...
you have the same option using the management interface (windows management
application, not web based)
what is your connection string to access your AS server? the one is grayed.
"ystueker" <ystueker@.discussions.microsoft.com> wrote in message
news:4FB35270-504A-41A3-91D0-469A4014018C@.microsoft.com...
> Thank you. I have tried that but my option for generate model is grayed
> out'
> "Jéjé" wrote:
>> to generate a report builder model based on an Analysis Database.
>> Simply go on the reports web site (http://localhost/reports)
>> create a new connection to your AS server
>> click "generate model"
>> and you have a model based on your OLAP cubes.
>> Also,
>> you can create your own model based on the DSV, this model will execute
>> SQL
>> statements against your source database instead of using the AS server
>> and
>> MDX statements.
>> but you have some manual work to do to insure that the model works fine
>> for
>> your needs. in another hand you have a better control of what you'll
>> display
>> to the end users (by playing with detailed property)
>> "ystueker" <ystueker@.discussions.microsoft.com> wrote in message
>> news:7E96DAE4-F823-4160-A7C1-C8D45772EE6B@.microsoft.com...
>> > This is my second posting. Please help!
>> >
>> > Hello,
>> > I have created a cube in Analysis Services and made many business logic
>> > changes in the Data Source View and dimensions. Can I use this to build
>> > a model for the Report builder? I believe they call this UDM? People
>> > will
>> > create ad-hoc reports in report builder.
>> >
>> > I know I can use the UDM to create reports in VS.
>> >
>> > Thank you
>> >
>>