Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Thursday, March 29, 2012

Error accessing registry value in report

We store environment specific information in the registry to ease moving from
dev, test and production environments. I'm making a call in the code window
to read from the registry and am getting this error:
Failed to load expression host assembly. Details: Request for the permission
of type System.Security.Permissions.RegistryPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
(rsProcessingError) Get Online Help
Just as a test I've changed all code access security zones to Full Trust but
this hasn't helped.
Please advise.This is what I had to do to get this working, if anyone's interested:
Edit C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\rssrvpolicy.config and modify the entry in the
Report_Expressions_Default_Permissions CodeGroup and change it from Execute
to FullTrust.
"Aaron" wrote:
> We store environment specific information in the registry to ease moving from
> dev, test and production environments. I'm making a call in the code window
> to read from the registry and am getting this error:
> Failed to load expression host assembly. Details: Request for the permission
> of type System.Security.Permissions.RegistryPermission, mscorlib,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
> (rsProcessingError) Get Online Help
> Just as a test I've changed all code access security zones to Full Trust but
> this hasn't helped.
> Please advise.
>|||Giving FullTrust to Report_Expressions_Default_Permissions totally opens
your server for hacker attacks. Now all expressions incliding VB.NET
snippets in Report.Code have fulltrust which allows them to perform any
operations, including formatting drives, reading and writing files etc...
The better way is to create a custom assembly with functions to read
registry and call this assembly from your reports. You will then give only
RegistryPermission to that assembly.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Aaron" <Aaron@.discussions.microsoft.com> wrote in message
news:281FF58C-043F-40DA-AFCF-4C413BFC2A49@.microsoft.com...
> This is what I had to do to get this working, if anyone's interested:
> Edit C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
> Services\ReportServer\rssrvpolicy.config and modify the entry in the
> Report_Expressions_Default_Permissions CodeGroup and change it from
Execute
> to FullTrust.
>
> "Aaron" wrote:
> > We store environment specific information in the registry to ease moving
from
> > dev, test and production environments. I'm making a call in the code
window
> > to read from the registry and am getting this error:
> >
> > Failed to load expression host assembly. Details: Request for the
permission
> > of type System.Security.Permissions.RegistryPermission, mscorlib,
> > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.
> > (rsProcessingError) Get Online Help
> >
> > Just as a test I've changed all code access security zones to Full Trust
but
> > this hasn't helped.
> >
> > Please advise.
> >|||Aaron I have done similar kind of thing, If your still facing the problem
write to me, I can help you out to fix the issue.
My Email ID:
balajikkrishnan [AT] rediffmail [DOT] com
Thanks
Balaji
--
Message posted via http://www.sqlmonster.comsql

Thursday, March 22, 2012

error 8152

I read the Error Handling article by Erland Sommarskog, he said when
ANSI_WARNINGS is OFF, assigning a char column a value that exceeds the max
length of the column will not result any error. But I still get error 8152:
String or binary data would be truncated, within a trigger, even I set
ANSI_WARNINGS to OFF. Anybody knows why? Is it because of the Trigger Contex
t?hi
Just see this:
ANSI_WARNINGS
When set to ON, errors or warnings are issued when conditions such as
"divide by zero" occur or null values appear in aggregate functions. When se
t
to OFF, no warnings are raised when null values appear in aggregate
functions, and null values are returned when conditions such as "divide by
zero" occur. By default, ANSI_WARNINGS is OFF.
SET ANSI_WARNINGS must be set to ON when you create or manipulate indexes on
computed columns or indexed views.
Connection-level settings (set using the SET statement) override the default
database setting for ANSI_WARNINGS. By default, ODBC and OLE DB clients issu
e
a connection-level SET statement setting ANSI_WARNINGS to ON for the session
when connecting to SQL Server. For more information, see SET ANSI_WARNINGS.
The status of this option can be determined by examining the
IsAnsiWarningsEnabled property of the DATABASEPROPERTYEX function
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"nonno" wrote:
> I read the Error Handling article by Erland Sommarskog, he said when
> ANSI_WARNINGS is OFF, assigning a char column a value that exceeds the max
> length of the column will not result any error. But I still get error 8152
:
> String or binary data would be truncated, within a trigger, even I set
> ANSI_WARNINGS to OFF. Anybody knows why? Is it because of the Trigger Context?[/co
lor]|||Can you post a reproduction script?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"nonno" <nonno@.discussions.microsoft.com> wrote in message
news:A6D01321-73CE-4EE8-BACC-B8C2B9A08F06@.microsoft.com...
>I read the Error Handling article by Erland Sommarskog, he said when
> ANSI_WARNINGS is OFF, assigning a char column a value that exceeds the max
> length of the column will not result any error. But I still get error 8152
:
> String or binary data would be truncated, within a trigger, even I set
> ANSI_WARNINGS to OFF. Anybody knows why? Is it because of the Trigger Context?[/co
lor]|||thx 4 ur reply, Chandra
I know that Query Analyzer is connected thro' ODBC, but I get 0 from
IsAnsiWarningsEnabled property of the DATABASEPROPERTYEX function, and I'm
sure that the connection property 'Set ansi_warnings' is ON, any idea?
"Chandra" wrote:
> hi
> Just see this:
> ANSI_WARNINGS
> When set to ON, errors or warnings are issued when conditions such as
> "divide by zero" occur or null values appear in aggregate functions. When
set
> to OFF, no warnings are raised when null values appear in aggregate
> functions, and null values are returned when conditions such as "divide by
> zero" occur. By default, ANSI_WARNINGS is OFF.
> SET ANSI_WARNINGS must be set to ON when you create or manipulate indexes
on
> computed columns or indexed views.
> Connection-level settings (set using the SET statement) override the defau
lt
> database setting for ANSI_WARNINGS. By default, ODBC and OLE DB clients is
sue
> a connection-level SET statement setting ANSI_WARNINGS to ON for the sessi
on
> when connecting to SQL Server. For more information, see SET ANSI_WARNINGS
.
> The status of this option can be determined by examining the
> IsAnsiWarningsEnabled property of the DATABASEPROPERTYEX function
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://groups.msn.com/SQLResource/
> ---
>
> "nonno" wrote:
>

Wednesday, March 21, 2012

error 7391 in distributed transaction

I have a procedure running locally on my server A. This procedure does an
insert into a table after getting a return value from a select done on
another server say B . Server B is set up as linked server on server A. th
error i get shows as
The operation could not be performed because the OLE DB provider 'SQLOLEDB'
was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
ITransactionJoin::JoinTransaction returned 0x8004d00a].
Has anyone seen this before? Is there any solution to this or any setting
that needs to be changed to get this working? any help will be greatly
appreciated.
TIA
Message posted via http://www.webservertalk.comFor distributed transaction you need to have a Primary key on updated table.
So pLease add primary key to resolve your issue. Please let me know if
doesn't work.
Regards,
Jagan Mohan
MCDBA
"ishaan99 via webservertalk.com" wrote:

> I have a procedure running locally on my server A. This procedure does an
> insert into a table after getting a return value from a select done on
> another server say B . Server B is set up as linked server on server A. th
> error i get shows as
> The operation could not be performed because the OLE DB provider 'SQLOLEDB
'
> was unable to begin a distributed transaction.
> [OLE/DB provider returned message: New transaction cannot enlist in the
> specified transaction coordinator. ]
> OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
> ITransactionJoin::JoinTransaction returned 0x8004d00a].
> Has anyone seen this before? Is there any solution to this or any setting
> that needs to be changed to get this working? any help will be greatly
> appreciated.
> TIA
> --
> Message posted via http://www.webservertalk.com
>|||I've had this same error, mine only happened during times when transactions
were high on the system, I think there is a setting to increase the number o
f
concurrent distributed transactions, don't know what else you could do, I
know it has to do with MSDTC.
"ishaan99 via webservertalk.com" wrote:

> I have a procedure running locally on my server A. This procedure does an
> insert into a table after getting a return value from a select done on
> another server say B . Server B is set up as linked server on server A. th
> error i get shows as
> The operation could not be performed because the OLE DB provider 'SQLOLEDB
'
> was unable to begin a distributed transaction.
> [OLE/DB provider returned message: New transaction cannot enlist in the
> specified transaction coordinator. ]
> OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
> ITransactionJoin::JoinTransaction returned 0x8004d00a].
> Has anyone seen this before? Is there any solution to this or any setting
> that needs to be changed to get this working? any help will be greatly
> appreciated.
> TIA
> --
> Message posted via http://www.webservertalk.com
>sql

Friday, March 9, 2012

Error 515

I get this error during Merge replication
" Cannot insert the value NULL into column 'nicknames', table
'REP_Sub.dbo.MSmerge_genhistory'; column does not allow nulls. INSERT fails. "
Can anyone help
Did you register your publisher or subscriber using an IP address? There
have been reports in the past that this can cause this problem.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Sesha" <Sesha@.discussions.microsoft.com> wrote in message
news:87EB3D3B-913F-4B6B-8FC7-471517A0F444@.microsoft.com...
> I get this error during Merge replication
> " Cannot insert the value NULL into column 'nicknames', table
> 'REP_Sub.dbo.MSmerge_genhistory'; column does not allow nulls. INSERT
fails. "
> Can anyone help
|||Sesha,
You must check @.@.servername on the SUBSCRIBER. This will probably return a
NULL.
Select * from sysservers
This will give you a list of local/linked/remote servers on that box. If you
returned NULL above, it's because the server has gotten confused about not
having a local named server (SRVID=0) to put in the nickname table.
If you don't have a SRVID=0 and your servername does exist in the list then
do the following:
SP_dropserver 'Servername'
go
Sp_Addserver 'Servername','local'
If it doesn't exist and you don't have SRVID=0 then just do the Add.
That should sort you out.
Good luck.
"Hilary Cotter" wrote:

> Did you register your publisher or subscriber using an IP address? There
> have been reports in the past that this can cause this problem.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Sesha" <Sesha@.discussions.microsoft.com> wrote in message
> news:87EB3D3B-913F-4B6B-8FC7-471517A0F444@.microsoft.com...
> fails. "
>
>

Sunday, February 26, 2012

error 30311: Value of type 'System.DBNull' cannot be converted to 'Date'

I'm creating an ISP for extractig data from a text file and put it in a database.

One of the fields in my textfile contains the value '0' or a date. If it's '0' it should be converted to the Null Value. The column in which it has to be saved is of type smalldatetime.

This is the code of my script where I want to check the value of the field in my textfile and convert it to a date or to Null.

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

If Row.cdDateIn = "" Or Row.cdDateIn= "0" Then

Row.cdDateInCorr = CDate(DBNull.Value)

ElseIf Row.cdDateIn_IsNull Then

Row.cdDateInCorr = CDate(DBNull.Value)

Else

Row.cdDateInCorr = CDate(Row.cdDateIn)

End If

End Sub

The error that I get is:

Validation error. Extract FinCD: Conversion of cdDateIn [753]: Eroor 30311: Value of type 'System.DBNull' cannot ben converted to 'Date'.

How do I resolve this problem ?

Why not use a derived column? Expression follows: (Typing from memory)

cdDateIn == "" || cdDateIn == "0" || ISNULL(cdDateIn) ? NULL(DT_DBTIMESTAMP) : (DT_DBTIMESTAMP)cdDateIn

|||You can just set Row.cdDateInCorr_IsNull = true.
|||

JayH wrote:

You can just set Row.cdDateInCorr_IsNull = true.

Correct, though if this is all you're doing in the script component, I would stay away from that and use a derived column. There's no reason for the overhead of the script in this case.

|||

I've used the code JayH suggested and this works.

Phil, your code is a bit like chinese to me. This ISP I'm working on is my first project in .NET. But I will check this derived column thing.

Thanks four your help.

|||

Phil Brammer wrote:

JayH wrote:

You can just set Row.cdDateInCorr_IsNull = true.

Correct, though if this is all you're doing in the script component, I would stay away from that and use a derived column. There's no reason for the overhead of the script in this case.

Are you sure about this - the IsNull property is for evaluation and not for assigning true or false to it - I believe that it will reset itself when you leave the script task - or am I wrong?
|||

Simon Givoni wrote:

Phil Brammer wrote:

JayH wrote:

You can just set Row.cdDateInCorr_IsNull = true.

Correct, though if this is all you're doing in the script component, I would stay away from that and use a derived column. There's no reason for the overhead of the script in this case.

Are you sure about this - the IsNull property is for evaluation and not for assigning true or false to it - I believe that it will reset itself when you leave the script task - or am I wrong?

Yes, I'm sure. You can set the property to True and the null will stick. You cannot set it to False, but it will automatically become False if you set a value to the column. SP2 will raise an exception if you set it to False.

|||Ah yes you are right - here are the full explanation:

The IsNull property of columns in the Script Component now raises a warning when it is used incorrectly.
The code generated by the Script component contains a <columnname> and a <columnname>_IsNull property for each input and output column. The intention of the <columnname>_IsNull property is to allow the user to specify a Null value for the column by setting the value of the property to True. To specify a non-null value, the user should assign a value to the <columnname> property. In earlier versions, if you set <columnname>_IsNull to False, the property was silently reset to True. In SP2, the Script component raises a warning message about the incorrect usage.

Source: http://msdn2.microsoft.com/en-us/library/bb283536.aspx#BKMK_IntegrationServices