Friday, March 30, 2012
known, expected or weird behavior ?
Please have a look at a script below:
USE tempdb
DECLARE @.t TABLE (c1 uniqueidentifier, c2 uniqueidentifier)
INSERT @.t (c1, c2)
SELECT y.id, NULL
FROM ( SELECT 1 UNION
SELECT 2 UNION
SELECT 3 UNION
SELECT 4 UNION
SELECT 5
) x (id)
CROSS JOIN
( SELECT NEWID() UNION
SELECT NEWID() UNION
SELECT NEWID() UNION
SELECT NEWID() UNION
SELECT NEWID()
) y (id)
UPDATE t
SET c2 = y.c2
FROM @.t t,
( SELECT c1, NEWID()
FROM ( SELECT DISTINCT c1
FROM @.t
) x (c1)
) y (c1, c2)
WHERE t.c1 = y.c1
SELECT * FROM @.T
I would expect c2 column value to be the same accross all records where c1
column value is the same.
But in fact c2 column is unique accross the table. I looked at plan and can
see what it's doing and I can rewrite it in a proper way but question
remains, - why is that? Can comeone explain that behavior?
Thank a lot in advance
AlexThat's the way functions work. They are executed for each row of the final
result.
What are you trying to do? If you need uniqueidentifier values for each
integer value, insert them into a temporary table (i.e. table variable)
before issuing the update.
ML
http://milambda.blogspot.com/|||my colleague came accros this piece of code. She reworked it with use of
temp table, and I could find a workaround with derived table. But why the
function is executed in the final set? The code imlies newid() should be
called inside derived table y, and then derived table y joins the table var?
"ML" <ML@.discussions.microsoft.com> wrote in message
news:BBDCFC04-63E4-4408-B153-26A1C5A9EB2B@.microsoft.com...
> That's the way functions work. They are executed for each row of the final
> result.
> What are you trying to do? If you need uniqueidentifier values for each
> integer value, insert them into a temporary table (i.e. table variable)
> before issuing the update.
>
> ML
> --
> http://milambda.blogspot.com/|||We'll know this for sure as soon as we find another system function that
produces as random results as NEWID(). :)
Have you tried using a user-defined function that returns a random result?
ML
http://milambda.blogspot.com/|||Interesting, I used RAND() and float instead of NEWID() and
uniqueidentifier, and in this case RAND() was applied to the final result
set too, but the difference seems to be that RAND() was called only once
since ALL records have the same float value.
No, I didn't used UDF yet, maybe later today when I have time.
"ML" <ML@.discussions.microsoft.com> wrote in message
news:FDDC2357-937A-42DF-8358-CFF69860095B@.microsoft.com...
> We'll know this for sure as soon as we find another system function that
> produces as random results as NEWID(). :)
> Have you tried using a user-defined function that returns a random result?
>
> ML
> --
> http://milambda.blogspot.com/|||NEWID is special. It is called for every row in a query. All other function
(the I know of) are
called only once in a query. Hence the difference between RAND and NEWID.
USE northwind
SELECT
NEWID() AS myNEWID
,RAND() AS myRand
,CURRENT_TIMESTAMP AS myTS
FROM "Order Details"
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Alex" <alex_remove_this_mak@.telus.net> wrote in message news:dB6Ef.153384$6K2.43614@.edtnps
90...
> Interesting, I used RAND() and float instead of NEWID() and uniqueidentifi
er, and in this case
> RAND() was applied to the final result set too, but the difference seems t
o be that RAND() was
> called only once since ALL records have the same float value.
> No, I didn't used UDF yet, maybe later today when I have time.
>
> "ML" <ML@.discussions.microsoft.com> wrote in message
> news:FDDC2357-937A-42DF-8358-CFF69860095B@.microsoft.com...
>|||This is the expected behaviour of RAND.
ML
http://milambda.blogspot.com/|||I was wondering whether getdate() is called for each row or for the set...
Would it show on a big enough set?
ML
http://milambda.blogspot.com/|||thanks guys a lot
"ML" <ML@.discussions.microsoft.com> wrote in message
news:D44C180C-8F26-461D-A552-9365B4DA27C9@.microsoft.com...
> This is the expected behaviour of RAND.
>
> ML
> --
> http://milambda.blogspot.com/|||Getdate() is normally only called once.
However, Itzik Ben-Gan came up with a really clever workaround for both
rand() and getdate().
Normally, you can't put getdate() or rand() in a User Defined Function, but
you can put them in a view, and then have your function select from the
view. You can then put your function in the select list, to have the
getdate() or rand() regenerated for each row.
Note that it might not look like getdate() is called for every single row,
because of the precision of the datatype. The function might be called
repeatedly more quickly than the getdate() value changes. But if you have
enough rows, you'll see that they aren't ALL the same, even though there
could be duplication.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"ML" <ML@.discussions.microsoft.com> wrote in message
news:30C35A84-706B-48F3-8C41-69ECB598DA13@.microsoft.com...
>I was wondering whether getdate() is called for each row or for the set...
> Would it show on a big enough set?
>
> ML
> --
> http://milambda.blogspot.com/
>
Known sp3a bugs.
We have upgraded to SQL Server 2000/sp2. When a service
pack comes, generally companies wait for sometime before
they apply. This is just to avoid potential new bugs and
find out some information.
My question is: Are there any known issues with SP3a? If
yes, what they are and whether its safe to apply the
patch.
Thanks in advance,
mzeeshanWe've had it installed on a dozen servers for awhile now with no problems. I
really think the practice of releasing patches has changed in that now they
are pretty thoroughly tested prior to public release. The problem with
waiting to install it is MS releases the bug fixes in the service pack once
they release the service pack and virus writers quickly write programs to
attach the patched holes knowing that admins are reluctant to patch the
systems right away. Not sure how to combat that but it is a problem
HTH.
--
Ray Higdon MCSE, MCDBA, CCNA
--
"mzeeshan" <mzeeshan@.yahoo.com> wrote in message
news:0fbe01c38a88$c3912300$a401280a@.phx.gbl...
> Hello everyone,
> We have upgraded to SQL Server 2000/sp2. When a service
> pack comes, generally companies wait for sometime before
> they apply. This is just to avoid potential new bugs and
> find out some information.
> My question is: Are there any known issues with SP3a? If
> yes, what they are and whether its safe to apply the
> patch.
> Thanks in advance,
> mzeeshan|||Thanks for your reply. I know the problems, the SQL
slammer worm was created by someone based on a CERT
advisory. And, if I am not wrong, the patch was already
there but not installed by users till it became the
problem. Fortunately, we were spared as all our boxes
were inaccessible from outside.
The flip side is the creation of new problems generated
by service packs themselves. If I can recall, there was a
service pack (may be 4 or 5) with WindowsNT that created
so many problems that a new one (sp6) was quickly
released.
Its good to hear that MS is more careful now.
Thanks anyway,
mzeeshan
>--Original Message--
>We've had it installed on a dozen servers for awhile now
with no problems. I
>really think the practice of releasing patches has
changed in that now they
>are pretty thoroughly tested prior to public release.
The problem with
>waiting to install it is MS releases the bug fixes in
the service pack once
>they release the service pack and virus writers quickly
write programs to
>attach the patched holes knowing that admins are
reluctant to patch the
>systems right away. Not sure how to combat that but it
is a problem
>HTH.
>--
>Ray Higdon MCSE, MCDBA, CCNA
>--
>"mzeeshan" <mzeeshan@.yahoo.com> wrote in message
>news:0fbe01c38a88$c3912300$a401280a@.phx.gbl...
>> Hello everyone,
>> We have upgraded to SQL Server 2000/sp2. When a service
>> pack comes, generally companies wait for sometime
before
>> they apply. This is just to avoid potential new bugs
and
>> find out some information.
>> My question is: Are there any known issues with SP3a?
If
>> yes, what they are and whether its safe to apply the
>> patch.
>> Thanks in advance,
>> mzeeshan
>
>.
>|||Didn't mean to sound insensitive to the concerns of reluctant admins, just
pointing it out, there's wisdom in waiting if you can afford to..everything
in one way or another is a cost-benefit analysis :)
GL
--
Ray Higdon MCSE, MCDBA, CCNA
--
"mzeeshan" <mzeeshan@.yahoo.com> wrote in message
news:2052f01c38a9e$01b99030$a601280a@.phx.gbl...
> Thanks for your reply. I know the problems, the SQL
> slammer worm was created by someone based on a CERT
> advisory. And, if I am not wrong, the patch was already
> there but not installed by users till it became the
> problem. Fortunately, we were spared as all our boxes
> were inaccessible from outside.
> The flip side is the creation of new problems generated
> by service packs themselves. If I can recall, there was a
> service pack (may be 4 or 5) with WindowsNT that created
> so many problems that a new one (sp6) was quickly
> released.
> Its good to hear that MS is more careful now.
> Thanks anyway,
> mzeeshan
> >--Original Message--
> >We've had it installed on a dozen servers for awhile now
> with no problems. I
> >really think the practice of releasing patches has
> changed in that now they
> >are pretty thoroughly tested prior to public release.
> The problem with
> >waiting to install it is MS releases the bug fixes in
> the service pack once
> >they release the service pack and virus writers quickly
> write programs to
> >attach the patched holes knowing that admins are
> reluctant to patch the
> >systems right away. Not sure how to combat that but it
> is a problem
> >
> >HTH.
> >
> >--
> >Ray Higdon MCSE, MCDBA, CCNA
> >--
> >"mzeeshan" <mzeeshan@.yahoo.com> wrote in message
> >news:0fbe01c38a88$c3912300$a401280a@.phx.gbl...
> >> Hello everyone,
> >>
> >> We have upgraded to SQL Server 2000/sp2. When a service
> >> pack comes, generally companies wait for sometime
> before
> >> they apply. This is just to avoid potential new bugs
> and
> >> find out some information.
> >>
> >> My question is: Are there any known issues with SP3a?
> If
> >> yes, what they are and whether its safe to apply the
> >> patch.
> >>
> >> Thanks in advance,
> >> mzeeshan
> >
> >
> >.
> >|||SP3 has all of MS's security fixes for SQL Server as well... I'd advise
going to it as quickly as you feel comfortable.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.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
"mzeeshan" <mzeeshan@.yahoo.com> wrote in message
news:0fbe01c38a88$c3912300$a401280a@.phx.gbl...
> Hello everyone,
> We have upgraded to SQL Server 2000/sp2. When a service
> pack comes, generally companies wait for sometime before
> they apply. This is just to avoid potential new bugs and
> find out some information.
> My question is: Are there any known issues with SP3a? If
> yes, what they are and whether its safe to apply the
> patch.
> Thanks in advance,
> mzeeshan
Known SMTP bug in .NET 2.0?
Hi All,
A while back I posted a message referring to an inability to send e-mail from SQL 2005 Database mail; the error being "Command not supported" - which appeared to be coming back from the Exchange Server.
Looking on the SQL Sentry forums (SQL Sentry having its own alerting function) they report the same errro testing their smtp code, with the post
This is the result of a known bug in .NET 2.0. when working with a server that does not support ESMTP. Microsoft will provide a fix in their next release.
Can anyone from MS confirm that this is a bug, and tell me how to either work round it, or enable ESMTP on the Exchange server?
Regards,
Richard
Just to close out this thread, should anyone be reading it in the future:
It appears that the exchange server is set up using non-standard ports to receive on, and also McAfee security is running to block data on all but the narrowly specified ports. Our exchange people kindly ommitted to tell us this, but the upshot is that nothing can send mail out through the Exchange server. The error message is a bit confusing, but the root cause is security, not SQL or the client.
Regards,
Rich
Known SMTP bug in .NET 2.0?
Hi All,
A while back I posted a message referring to an inability to send e-mail from SQL 2005 Database mail; the error being "Command not supported" - which appeared to be coming back from the Exchange Server.
Looking on the SQL Sentry forums (SQL Sentry having its own alerting function) they report the same errro testing their smtp code, with the post
This is the result of a known bug in .NET 2.0. when working with a server that does not support ESMTP. Microsoft will provide a fix in their next release.Can anyone from MS confirm that this is a bug, and tell me how to either work round it, or enable ESMTP on the Exchange server?
Regards,
Richard
Just to close out this thread, should anyone be reading it in the future:
It appears that the exchange server is set up using non-standard ports to receive on, and also McAfee security is running to block data on all but the narrowly specified ports. Our exchange people kindly ommitted to tell us this, but the upshot is that nothing can send mail out through the Exchange server. The error message is a bit confusing, but the root cause is security, not SQL or the client.
Regards,
Rich
sqlKnown issues of upgrading from SQL 2000 to SQL 2005
Should work fine. If you'd like to see a list of known issues/workarounds/notes/etc. for SQL 2005, go to the support.microsoft.com site and search for SQL Server 2005 articles. There are some considerations to take into account when migrating from 2000 to 2005, but those are more on the server side of things, not the client.
Obviously, there is no guarantee, but this is definately supported and being done elsewhere, so implement a sound testing plan prior to rollout and you should be good to go.
HTH
Known Issues for SQL Server 2000 SP4
I am looking for known issues for SQL Server Service Pack 4 before I apply
Service pack 4.
If anybody has URL or list of problems, please let me know.
Thanks,
MunirThe only issue that was found, that I'm aware of, was a bug where only
half of the physical memory in the box could be used by SQL Server when
using AWE on a 32-bit instance.
There is a hotfix for this now:
http://support.microsoft.com/defaul...kb;en-us;899761
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Munir wrote:
>Hi All,
>I am looking for known issues for SQL Server Service Pack 4 before I apply
>Service pack 4.
>If anybody has URL or list of problems, please let me know.
>Thanks,
>Munir
>
Known Issues for SQL Server 2000 SP4
I am looking for known issues for SQL Server Service Pack 4 before I apply
Service pack 4.
If anybody has URL or list of problems, please let me know.
Thanks,
Munir
The only issue that was found, that I'm aware of, was a bug where only
half of the physical memory in the box could be used by SQL Server when
using AWE on a 32-bit instance.
There is a hotfix for this now:
http://support.microsoft.com/default...b;en-us;899761
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Munir wrote:
>Hi All,
>I am looking for known issues for SQL Server Service Pack 4 before I apply
>Service pack 4.
>If anybody has URL or list of problems, please let me know.
>Thanks,
>Munir
>
Known Issues for SQL Server 2000 SP4
I am looking for known issues for SQL Server Service Pack 4 before I apply
Service pack 4.
If anybody has URL or list of problems, please let me know.
Thanks,
MunirThis is a multi-part message in MIME format.
--050601080709030205010702
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
The only issue that was found, that I'm aware of, was a bug where only
half of the physical memory in the box could be used by SQL Server when
using AWE on a 32-bit instance.
There is a hotfix for this now:
http://support.microsoft.com/default.aspx?scid=kb;en-us;899761
--
*mike hodgson*
blog: http://sqlnerd.blogspot.com
Munir wrote:
>Hi All,
>I am looking for known issues for SQL Server Service Pack 4 before I apply
>Service pack 4.
>If anybody has URL or list of problems, please let me know.
>Thanks,
>Munir
>
--050601080709030205010702
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>The only issue that was found, that I'm aware of, was a bug where
only half of the physical memory in the box could be used by SQL Server
when using AWE on a 32-bit instance.<br>
<br>
There is a hotfix for this now:<br>
<a class="moz-txt-link-freetext" href="http://links.10026.com/?link=http://support.microsoft.com/default.aspx?scid=kb;en-us;899761</a></tt><br>">http://support.microsoft.com/default.aspx?scid=kb;en-us;899761">http://support.microsoft.com/default.aspx?scid=kb;en-us;899761</a></tt><br>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2">blog:</font><font face="Tahoma" size="2"> <a
href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
<br>
Munir wrote:
<blockquote cite="midCB8919B9-0FFF-4C42-80EC-984815FCE563@.microsoft.com"
type="cite">
<pre wrap="">Hi All,
I am looking for known issues for SQL Server Service Pack 4 before I apply
Service pack 4.
If anybody has URL or list of problems, please let me know.
Thanks,
Munir
</pre>
</blockquote>
</body>
</html>
--050601080709030205010702--|||You should also read the readme files and the addendum to the readme
files:
http://www.microsoft.com/downloads/details.aspx?familyid=8E2DFC8D-C20E-4446-99A9-B7F0213F8BC5&displaylang=en#filelist
http://support.microsoft.com/kb/884525/
Razvan
Known fields are not returned by using a stored procedure
I am trying to use a stored procedure to get data, but I can't get it right.
So far I have done this:
1) In the "Edit selected dataset" dialogue in the query tab I have entered
the name of the stored procedure.
2) In the Parameter tab I have entered the parameters for the stored
procedure, e.g. "@.UserId" etc.
3) I have added report parameters to the report and related them to the sql
parameters by selecting them in the parameter tab of the "Edit selected
dataset" dialogue.
For report parameters that should be null, I have checked "allow null" and
set default parameter to "None".
4) In the field tab of the "Edit selected dataset" I have entered field
names of fields, that I know that this stored procedure will return.
When I try to preview the report, I get an error message saying that there
are no fields corresponding to the field names I have entered. I have tried
query analyzer with the same parameters, and I know which fiels should be
there.
What am I doing wrong?
Thanks for any help.
DorteGoing against SQL Server I have yet seen the need to enter the fields by
hand (although it should have worked). What back end are you going against?
Have you tried clicking on the refresh field list button (it is the button
on the right of the ... that looks like the refresh button for IE)? Do you
get any data back when you execute it in the data tab. RS has to run the
stored procedure to be able to get the list. If you have a parameter then
when you do this (execute it from the data tab) it should prompt you for a
value.
Bruce L-C
"Dorte" <Dorte@.discussions.microsoft.com> wrote in message
news:ED389036-E3CC-4DF5-9BBB-17C133BC7A89@.microsoft.com...
> Hi,
> I am trying to use a stored procedure to get data, but I can't get it
right.
> So far I have done this:
> 1) In the "Edit selected dataset" dialogue in the query tab I have entered
> the name of the stored procedure.
> 2) In the Parameter tab I have entered the parameters for the stored
> procedure, e.g. "@.UserId" etc.
> 3) I have added report parameters to the report and related them to the
sql
> parameters by selecting them in the parameter tab of the "Edit selected
> dataset" dialogue.
> For report parameters that should be null, I have checked "allow null" and
> set default parameter to "None".
> 4) In the field tab of the "Edit selected dataset" I have entered field
> names of fields, that I know that this stored procedure will return.
>
> When I try to preview the report, I get an error message saying that there
> are no fields corresponding to the field names I have entered. I have
tried
> query analyzer with the same parameters, and I know which fiels should be
> there.
> What am I doing wrong?
> Thanks for any help.
> Dorte|||Now it works!
I'm using SQL server 2000, and I did allready enter the fields by hand, but
apparently that wasn't enough! But your advice to push the refresh button did
the
trick!!
Thanks a lot!
Dorte
"Bruce Loehle-Conger" wrote:
> Going against SQL Server I have yet seen the need to enter the fields by
> hand (although it should have worked). What back end are you going against?
> Have you tried clicking on the refresh field list button (it is the button
> on the right of the ... that looks like the refresh button for IE)? Do you
> get any data back when you execute it in the data tab. RS has to run the
> stored procedure to be able to get the list. If you have a parameter then
> when you do this (execute it from the data tab) it should prompt you for a
> value.
> Bruce L-C
> "Dorte" <Dorte@.discussions.microsoft.com> wrote in message
> news:ED389036-E3CC-4DF5-9BBB-17C133BC7A89@.microsoft.com...
> > Hi,
> > I am trying to use a stored procedure to get data, but I can't get it
> right.
> > So far I have done this:
> >
> > 1) In the "Edit selected dataset" dialogue in the query tab I have entered
> > the name of the stored procedure.
> >
> > 2) In the Parameter tab I have entered the parameters for the stored
> > procedure, e.g. "@.UserId" etc.
> >
> > 3) I have added report parameters to the report and related them to the
> sql
> > parameters by selecting them in the parameter tab of the "Edit selected
> > dataset" dialogue.
> > For report parameters that should be null, I have checked "allow null" and
> > set default parameter to "None".
> >
> > 4) In the field tab of the "Edit selected dataset" I have entered field
> > names of fields, that I know that this stored procedure will return.
> >
> >
> > When I try to preview the report, I get an error message saying that there
> > are no fields corresponding to the field names I have entered. I have
> tried
> > query analyzer with the same parameters, and I know which fiels should be
> > there.
> >
> > What am I doing wrong?
> >
> > Thanks for any help.
> >
> > Dorte
>
>sql
known error with Transfer SQL Server Objects Task...
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=127100
I don't believe that the fix to the above issue has made its way into an SP yet. Can anyone confirm/refute this, and/or state when the fix will become publicly available &/or give a workaround?
Thanks,
Tamim.
This issue was fixed in SP1.Known assembly FileIOPermission error, still no solution
getting FileIOPermission. The only way I can get it to work is by
changing the PermissionSetName of the whole CodeGroup from Nothing to
FullTrust. The assembly itself is very simple and all it does is it
writes one line to a text file.
Here is what I did so far:
1. I asserted the permission in my code.
2. I put the text file and my assembly into ReportSevrer bin folder and
changed the text file's security to allow "NETWORK SECURITY" (it
is IIS6) and just in case "Everyone" to write to it.
3. I added CodeGroup just after the code group with Url="$CodeGen$/*"
to the rssrvpolicy.config file with PermissionSetName="FullTrust".
I even installed Visual Studio 2005 to get access to PermCalc tool.
All it showed me was that my dll needs FileIOPermission with
Unrestricted="true" and SecurityPermission with
Flags="Assertion" in the CodeGroup which I also tried by creating a
seperate PermissionSet.
What else can I possibly try?
My Code:
private void WriteLogFile(String msg)
{
FileIOPermission perm1 = new
FileIOPermission(FileIOPermissionAccess.Write, @."C:\Program
Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\ReportLogger.log");
perm1.Assert();
FileStream fs = new FileStream(@."C:\Program Files\Microsoft SQL
Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log",
FileMode.OpenOrCreate, FileAccess.ReadWrite);
StreamWriter w = new StreamWriter(fs);
w.BaseStream.Seek(0, SeekOrigin.End);
w.Write("{0} {1} ", DateTime.Now.ToLongTimeString(),
DateTime.Now.ToLongDateString());
w.Write(msg + "\r\n");
w.Flush();
w.Close();
}
My CodeGroup:
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="CGReportHelper"
Description="Allow execution of ReportHelper.dll">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="file://C:/Program Files/Microsoft SQL Server/MSSQL/Reporting
Services/ReportServer/bin/ReportHelper.dll"/>
</CodeGroup>
My Error:
w3wp!processing!2aa8!10/05/2005-16:47:17:: e ERROR: Failed to load
expression host assembly. Details: Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.
System.Security.SecurityException: Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.
at
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark,
Int32 checkFrames, Int32 unrestrictedOverride)
at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access)
at ReportHelper.ConfirmationStatement.WriteLogFile(String msg)
at ReportHelper.ConfirmationStatement..ctor(Int32 futureBatchSetId)
at CustomCodeProxy.OnInit()
at Microsoft.ReportingServices.ReportProcessing.ExprHostObjectModel.
CustomCodeProxyBase..ctor(IReportObjectModelProxyForCustomCode
reportObjectModel)
at ReportExprHostImpl..ctor(Boolean parametersOnly, Object
reportObjectModel)
The state of the failed permission was:
<IPermission class="System.Security.Permissions.FileIOPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Read="C:\Program Files\Microsoft SQL
Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log"
Write="C:\Program Files\Microsoft SQL
Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log"/>
w3wp!processing!2aa8!10/05/2005-16:47:17:: e ERROR: Throwing
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Exception of type
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
was thrown., ;
Info:
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Exception of type
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
was thrown.
w3wp!library!2aa8!10/05/2005-16:47:17:: i INFO: Initializing
EnableExecutionLogging to 'True' as specified in Server system
properties.
w3wp!webserver!2aa8!10/05/2005-16:47:17:: e ERROR: Reporting Services
error Microsoft.ReportingServices.Diagnostics.Utilities.RSException:
Failed to load expression host assembly. Details: Request for the
permission of type System.Security.Permissions.FileIOPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed. -->
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Failed to load expression host assembly. Details: Request for the
permission of type System.Security.Permissions.FileIOPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.Hi,
See this article....
http://www.c-sharpcorner.com/Code/2005/June/CustomAssemblyinRS.asp
If still you have the issue, write to me bkkrishnan [at] hotmail [dot] com
Balaji
Siwy wrote:
>I'm trying to write to a text file from my custom assembly and I keep
>getting FileIOPermission. The only way I can get it to work is by
>changing the PermissionSetName of the whole CodeGroup from Nothing to
>FullTrust. The assembly itself is very simple and all it does is it
>writes one line to a text file.
>Here is what I did so far:
>1. I asserted the permission in my code.
>2. I put the text file and my assembly into ReportSevrer bin folder and
>changed the text file's security to allow "NETWORK SECURITY" (it
>is IIS6) and just in case "Everyone" to write to it.
>3. I added CodeGroup just after the code group with Url="$CodeGen$/*"
>to the rssrvpolicy.config file with PermissionSetName="FullTrust".
>I even installed Visual Studio 2005 to get access to PermCalc tool.
>All it showed me was that my dll needs FileIOPermission with
>Unrestricted="true" and SecurityPermission with
>Flags="Assertion" in the CodeGroup which I also tried by creating a
>seperate PermissionSet.
>What else can I possibly try?
>My Code:
>private void WriteLogFile(String msg)
>{
> FileIOPermission perm1 = new
>FileIOPermission(FileIOPermissionAccess.Write, @."C:\Program
>Files\Microsoft SQL Server\MSSQL\Reporting
>Services\ReportServer\bin\ReportLogger.log");
> perm1.Assert();
> FileStream fs = new FileStream(@."C:\Program Files\Microsoft SQL
>Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log",
>FileMode.OpenOrCreate, FileAccess.ReadWrite);
> StreamWriter w = new StreamWriter(fs);
> w.BaseStream.Seek(0, SeekOrigin.End);
> w.Write("{0} {1} ", DateTime.Now.ToLongTimeString(),
> DateTime.Now.ToLongDateString());
> w.Write(msg + "\r\n");
> w.Flush();
> w.Close();
>}
>My CodeGroup:
><CodeGroup class="UnionCodeGroup"
> version="1"
> PermissionSetName="FullTrust"
> Name="CGReportHelper"
> Description="Allow execution of ReportHelper.dll">
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
>Url="file://C:/Program Files/Microsoft SQL Server/MSSQL/Reporting
>Services/ReportServer/bin/ReportHelper.dll"/>
></CodeGroup>
>My Error:
>w3wp!processing!2aa8!10/05/2005-16:47:17:: e ERROR: Failed to load
>expression host assembly. Details: Request for the permission of type
>System.Security.Permissions.FileIOPermission, mscorlib,
>Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
>failed.
>System.Security.SecurityException: Request for the permission of type
>System.Security.Permissions.FileIOPermission, mscorlib,
>Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
>failed.
> at
>System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
>grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
>PermissionToken permToken)
> at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
>permToken, CodeAccessPermission demand, StackCrawlMark& stackMark,
>Int32 checkFrames, Int32 unrestrictedOverride)
> at
>System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
>cap, StackCrawlMark& stackMark)
> at System.Security.CodeAccessPermission.Demand()
> at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
>access, FileShare share, Int32 bufferSize, Boolean useAsync, String
>msgPath, Boolean bFromProxy)
> at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
>access)
> at ReportHelper.ConfirmationStatement.WriteLogFile(String msg)
> at ReportHelper.ConfirmationStatement..ctor(Int32 futureBatchSetId)
> at CustomCodeProxy.OnInit()
> at Microsoft.ReportingServices.ReportProcessing.ExprHostObjectModel.
>CustomCodeProxyBase..ctor(IReportObjectModelProxyForCustomCode
>reportObjectModel)
> at ReportExprHostImpl..ctor(Boolean parametersOnly, Object
>reportObjectModel)
>The state of the failed permission was:
><IPermission class="System.Security.Permissions.FileIOPermission,
>mscorlib, Version=1.0.5000.0, Culture=neutral,
>PublicKeyToken=b77a5c561934e089"
> version="1"
> Read="C:\Program Files\Microsoft SQL
>Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log"
> Write="C:\Program Files\Microsoft SQL
>Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log"/>
>w3wp!processing!2aa8!10/05/2005-16:47:17:: e ERROR: Throwing
>Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
>Exception of type
>Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
>was thrown., ;
> Info:
>Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
>Exception of type
>Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
>was thrown.
>w3wp!library!2aa8!10/05/2005-16:47:17:: i INFO: Initializing
>EnableExecutionLogging to 'True' as specified in Server system
>properties.
>w3wp!webserver!2aa8!10/05/2005-16:47:17:: e ERROR: Reporting Services
>error Microsoft.ReportingServices.Diagnostics.Utilities.RSException:
>Failed to load expression host assembly. Details: Request for the
>permission of type System.Security.Permissions.FileIOPermission,
>mscorlib, Version=1.0.5000.0, Culture=neutral,
>PublicKeyToken=b77a5c561934e089 failed. -->
>Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
>Failed to load expression host assembly. Details: Request for the
>permission of type System.Security.Permissions.FileIOPermission,
>mscorlib, Version=1.0.5000.0, Culture=neutral,
>PublicKeyToken=b77a5c561934e089 failed.
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200510/1|||I finally figured it out.
The problem was with assertion in my code. I changed it from
FileIOPermissionAccess.Write to FileIOPermissionAccess.AllAccess and it
worked.
I guess when you open a file with FileAccess.ReadWrite then assertion
FileIOPermissionAccess.Write is not enough.
Regards,|||Hi,
I'm custom assemblie to access the registry and get some data..
i'm getting a error of "Requested registry access is not allowed"
I followed all the steps that you mentioned but i still get the same error..
but in case of File access it works im not getting any error but for
Registry acccess im getting that error. did you tried using registry. i even
gave "FullTrust" in the the permission policy file.
Please let me know if any one have tried registree.
Thanks
Bava
"BALAJI K via SQLMonster.com" wrote:
> Hi,
> See this article....
> http://www.c-sharpcorner.com/Code/2005/June/CustomAssemblyinRS.asp
> If still you have the issue, write to me bkkrishnan [at] hotmail [dot] com
> Balaji
>
> Siwy wrote:
> >I'm trying to write to a text file from my custom assembly and I keep
> >getting FileIOPermission. The only way I can get it to work is by
> >changing the PermissionSetName of the whole CodeGroup from Nothing to
> >FullTrust. The assembly itself is very simple and all it does is it
> >writes one line to a text file.
> >
> >Here is what I did so far:
> >
> >1. I asserted the permission in my code.
> >2. I put the text file and my assembly into ReportSevrer bin folder and
> >changed the text file's security to allow "NETWORK SECURITY" (it
> >is IIS6) and just in case "Everyone" to write to it.
> >3. I added CodeGroup just after the code group with Url="$CodeGen$/*"
> >to the rssrvpolicy.config file with PermissionSetName="FullTrust".
> >
> >I even installed Visual Studio 2005 to get access to PermCalc tool.
> >All it showed me was that my dll needs FileIOPermission with
> >Unrestricted="true" and SecurityPermission with
> >Flags="Assertion" in the CodeGroup which I also tried by creating a
> >seperate PermissionSet.
> >
> >What else can I possibly try?
> >
> >My Code:
> >
> >private void WriteLogFile(String msg)
> >{
> > FileIOPermission perm1 = new
> >FileIOPermission(FileIOPermissionAccess.Write, @."C:\Program
> >Files\Microsoft SQL Server\MSSQL\Reporting
> >Services\ReportServer\bin\ReportLogger.log");
> > perm1.Assert();
> >
> > FileStream fs = new FileStream(@."C:\Program Files\Microsoft SQL
> >Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log",
> >FileMode.OpenOrCreate, FileAccess.ReadWrite);
> > StreamWriter w = new StreamWriter(fs);
> > w.BaseStream.Seek(0, SeekOrigin.End);
> > w.Write("{0} {1} ", DateTime.Now.ToLongTimeString(),
> > DateTime.Now.ToLongDateString());
> > w.Write(msg + "\r\n");
> > w.Flush();
> >
> > w.Close();
> >}
> >
> >My CodeGroup:
> >
> ><CodeGroup class="UnionCodeGroup"
> > version="1"
> > PermissionSetName="FullTrust"
> > Name="CGReportHelper"
> > Description="Allow execution of ReportHelper.dll">
> > <IMembershipCondition class="UrlMembershipCondition"
> > version="1"
> >Url="file://C:/Program Files/Microsoft SQL Server/MSSQL/Reporting
> >Services/ReportServer/bin/ReportHelper.dll"/>
> ></CodeGroup>
> >
> >My Error:
> >
> >w3wp!processing!2aa8!10/05/2005-16:47:17:: e ERROR: Failed to load
> >expression host assembly. Details: Request for the permission of type
> >System.Security.Permissions.FileIOPermission, mscorlib,
> >Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
> >failed.
> >System.Security.SecurityException: Request for the permission of type
> >System.Security.Permissions.FileIOPermission, mscorlib,
> >Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
> >failed.
> > at
> >System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
> >grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
> >PermissionToken permToken)
> > at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
> >permToken, CodeAccessPermission demand, StackCrawlMark& stackMark,
> >Int32 checkFrames, Int32 unrestrictedOverride)
> > at
> >System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
> >cap, StackCrawlMark& stackMark)
> > at System.Security.CodeAccessPermission.Demand()
> > at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
> >access, FileShare share, Int32 bufferSize, Boolean useAsync, String
> >msgPath, Boolean bFromProxy)
> > at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
> >access)
> > at ReportHelper.ConfirmationStatement.WriteLogFile(String msg)
> > at ReportHelper.ConfirmationStatement..ctor(Int32 futureBatchSetId)
> > at CustomCodeProxy.OnInit()
> > at Microsoft.ReportingServices.ReportProcessing.ExprHostObjectModel.
> >CustomCodeProxyBase..ctor(IReportObjectModelProxyForCustomCode
> >reportObjectModel)
> > at ReportExprHostImpl..ctor(Boolean parametersOnly, Object
> >reportObjectModel)
> >
> >The state of the failed permission was:
> ><IPermission class="System.Security.Permissions.FileIOPermission,
> >mscorlib, Version=1.0.5000.0, Culture=neutral,
> >PublicKeyToken=b77a5c561934e089"
> > version="1"
> > Read="C:\Program Files\Microsoft SQL
> >Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log"
> > Write="C:\Program Files\Microsoft SQL
> >Server\MSSQL\Reporting Services\ReportServer\bin\ReportLogger.log"/>
> >
> >w3wp!processing!2aa8!10/05/2005-16:47:17:: e ERROR: Throwing
> >Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
> >Exception of type
> >Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
> >was thrown., ;
> > Info:
> >Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
> >Exception of type
> >Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
> >was thrown.
> >w3wp!library!2aa8!10/05/2005-16:47:17:: i INFO: Initializing
> >EnableExecutionLogging to 'True' as specified in Server system
> >properties.
> >w3wp!webserver!2aa8!10/05/2005-16:47:17:: e ERROR: Reporting Services
> >error Microsoft.ReportingServices.Diagnostics.Utilities.RSException:
> >Failed to load expression host assembly. Details: Request for the
> >permission of type System.Security.Permissions.FileIOPermission,
> >mscorlib, Version=1.0.5000.0, Culture=neutral,
> >PublicKeyToken=b77a5c561934e089 failed. -->
> >Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
> >Failed to load expression host assembly. Details: Request for the
> >permission of type System.Security.Permissions.FileIOPermission,
> >mscorlib, Version=1.0.5000.0, Culture=neutral,
> >PublicKeyToken=b77a5c561934e089 failed.
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200510/1
>