Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Monday, March 26, 2012

making sense of deadlock

Example,
1) Two transactions, A and B have a Shared Lock on a resource
2) Both intend to update the resource
3) Transaction A comes in an places an Update lock on the resource
4) Transaction A then tries to do a Exclusive Lock on the resource.
Shouldnt step 4 cause a deadlock since Transaction B is waiting on A to
release its locks, while Transaction A is waiting on B to release the Shared
lock before it can place the Exclusive Lock on the same resource?
Im a little ... thanks for any insight.
GNo, it won't cause a deadlock. Obtaining the update lock ensures that only
Transaction A can transition to an exclusive lock on the resource in order t
o
perform the update. Obtaining the update lock ensures that Transaction A
doesn't have to wait for Transaction B to release its shared lock before it
can transition to an exclusive lock to perform the modification.
READ: "Understanding Locking in SQL Server" in books online.
"Girish" wrote:

> Example,
> 1) Two transactions, A and B have a Shared Lock on a resource
> 2) Both intend to update the resource
> 3) Transaction A comes in an places an Update lock on the resource
> 4) Transaction A then tries to do a Exclusive Lock on the resource.
> Shouldnt step 4 cause a deadlock since Transaction B is waiting on A to
> release its locks, while Transaction A is waiting on B to release the Shar
ed
> lock before it can place the Exclusive Lock on the same resource?
> Im a little ... thanks for any insight.
> G
>
>

Monday, March 19, 2012

make selection of your query result

i will try to explain what i want with an example

if have a query that returns

user code amount

user1 A 10

user1 B 100

user1 C 10

user2 B 50

user2 D 10

user3 A 10

user3 C 20

what i want in my report is the following as result

Sum of code A and C Sum of code B and D

user1 20 100

user2 60

user3 30

so can you make variables on the scope user that do a selection on the 'code'

in words like a variable that give me the sum of the amount where code in A and C in the scope user

Maybe this is not the best choice but it works.

We have:

Usuario Code Amount
--

Alejandro C 200
Erika A 50
Erika B 50
Karla D 100
Marcos A 100
Marcos B 50
Marcos C 25
Marcos D 70
Pedro A 100
Pedro C 70

and the code Returns

usuario F_Group S_Group
- - -
Alejandro 200 0
Erika 50 50
Karla 0 100
Marcos 125 120
Pedro 170 0

Code Snippet

--declare the parameters
declare @.F_group_1 varchar(2)
declare @.F_group_2 varchar(2)
declare @.S_group_1 varchar(2)
declare @.S_group_2 varchar(2)
--set value to parameters or define scoupe
select @.F_group_1='A',
@.F_group_2='C',
@.S_group_1='B',
@.S_group_2='D'
--sum both result
select qry.usuario, sum(qry.F_group) F_Group, sum(qry.S_group) S_Group
from (
-- sum the first group and in the 2nd we put 0
select usuario, sum(amount) F_group , 0 as S_group
from tabla
where code in (@.F_group_1, @.F_group_2)
group by usuario
union
-- sum the 2nd group and in the 1st we put 0
select usuario, 0 as F_group, sum(amount) S_group
from tabla
where code in (@.S_group_1, @.S_group_2)
group by usuario
) as qry
group by qry.usuario

Regards,

Marcos

|||

your solution is done at/in the query / datasource and i thought about that too

but is there a solution possible in report itself ?

like in businesobject you can make variables who are sum of an amount in a scope and with a where condition

on the report

|||

Krisje,

If I understand you correctly the following should work.

1. Use a table with 3 columns

2. Insert a group and set it to group on user

3. On the group row set column 1 expesression to fields!user

4. On the group row set column 2 to

=sum(iif(Fields!code.Value="A" or Fields!code.Value="C",Fields!amount.Value,0))

5. On the group row set column 2 to

=sum(iif(Fields!code.Value="A" or Fields!code.Value="C",0,Fields!amount.Value))

Monday, March 12, 2012

Make a Common Color Palette

What would be the best approach for having all the reports share a color palette.

What i want to achieve is that when we want to change for example the color of our column header i somewhere change a value and all reports are modified. That somewhere might be a config file, a sql table, a registerentry, ....

I know i could change all rdl files but that's nog a approach i want to develop.

Kinds Regards

Sorry, never checked the <expression> possibility.

I mean, i know the option but never thought that even color had this option. Great.

|||

Btw, you may find the following article useful: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/MoreSSRSCharts.asp

It also contains an example about using custom color palettes.

-- Robert

Friday, March 9, 2012

Major difficulties deploying a custom data extension

I have been trying for days to get a custmized data extension that I
built using the example at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/RSDSetEx3.asp
to be recognized by the report server on a Windows 2003 box. It is
recognized and works well on my development machine. I have followed
the recommended steps outlined below:
1) Create an entry in RSReportServer.config:
<Extension Name="Dataset"
Type="DataSetExtension.DSXConnection,RSCustomData"/>
DatesetExtension.DSXConnection is the correct namespace (I customized
it), RSCustomData.dll is the name of the assembly which has been placed
in the following folder:
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin
2) Create a new code group entry in rssrvpolicy.config. This
potentially could be the source of the problem, as I have received
conflicting recommendations on where in the code group heirarchy I
should place the new entry. I am currently placing it under the
"Url="$CodeGen$/*" entry
3) Restarted IIS and restarted SQLServer. Is there any reason why the
PC should have to be restarted? When does RSReportServer.config and
rssrvpolicy.config get loaded?
I then created a web service client and called the ListExtensions
method of the resportservice.asmx web service. It only lists the
original 4 data extensions - SQL, OLEDB, ORACLE and ODBC. After
dozends of attempts over several days and after reinstalling Reporting
Services, I still am having no luck getting the data extension to be
recognized on the server. Even though it works great on the dev
machine and I can step through the code without a problem.
Bonus question: One post mentioned the
<securityPolicy>
<trustLevel name="RosettaSrv" policyFile="rssrvpolicy.config"
/>
</securityPolicy>
<trust level="RosettaSrv" originUrl="" />
entry in web.config as a potential source of the problem. Searches on
google for RosettaSrv turn up almost nothing. Does this have any
effect on giving permissions to custom assemblies?
Thanks in advance for your help.I worked with Microsoft and got the problem solved. It was a
permissions issue on the assembly that I copied from my development
machine to the reporting server. We used filemon.exe to show that the
assembly was not being loaded. Other notes from Microsoft:
"Resolution:
By adding read & execute permissions to the Report Server directory for
the Users group, and allowing parent permissions to propagate to the
custom dll in the bin directory, the report server was able to load the
custom dll and display the custom data extension. In resolving this
case we used FileMon from SysInternals.com.