Can I Apply A Database Function Or Assembly Call In An Expression For Filter Data?

Mar 28, 2007

I need to translate a user€™s regional setting into one of our own language codes before I send it through as a filter to the model query. If our language codes were the same, the filter would look like this in the report filter -
Language Code = GetUserCulture()
Which translates to this in the database query (for us english) -
table.language_code = 'EN-us'
And of course I need it to look like this -
table.language_code = 'ENG'

I would like the logic to be globally available to all report writers (ie not forcing each report writer to have an iif or case stataement). I was thinking custom assemblies or maybe a database function, but at this level of the filter, I cannot seem to figure out how to embed a database function call to apply to the filter criteria like this
Language Code = dbo.ConvertFcnIWrote(GetUserCulture())
Or how I would access the custom assembly in the filter expression.

Do you have a recommended implementation for this situation?

Thanks,
Toni Fielder

View 4 Replies


ADVERTISEMENT

Failed To Load Expression Host Assembly. Details: StrongName Cannot Have An Empty String For The Assembly Name.

Jan 12, 2006

I previously had an ASP.NET 1.1 site running on my IIS 6.0 server (not the default website) with Reporting Services running in a subdirectory of that website.  I recently upgraded to ASP.NET 2.0 for my website and was greeted with an error when trying to view a report.  The error was very non-descript, but when I checked the server logs, it recorded the details as "It is not possible to run two different versions of ASP.NET in the same IIS process.  Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process."

 

First of all, I could not figure out where and how to do this.  Secondly, I decided to try to also change the Reporting Services folders to run ASP.NET 2.0 and when I did, I was greeted with the following message when attempting to view a report:

 

"Failed to load expression host assembly. Details: StrongName cannot have an empty string for the assembly name."

Please help.

View 7 Replies View Related

SQL Server Admin 2014 :: How A New Partition Function Apply For Current Data

Apr 15, 2015

I have a heavy database , More than 100 GB only for six month .every Query on it takes me along time and I dont have enough space to add more indexes.by a way I decided to do partitioning. I create a partition function , on date filed and all Data records per month was appointed to a separate file.And is partitioning only for Future data entry?

View 9 Replies View Related

How To Selectively Apply A Filter

Mar 20, 2007

Based on some report parameters value?

My dataset to display is coming from a stored procedure. Now based on a report parameter which user selects, I want to filter the results being displayed but only if user selects certain value in the parameter drop down. I tried using iif statement and I can use it to filter dataset based on parameter but can't get how NOT to apply the filter for a particular value of the user selected parameter.

Hope I am clear.

View 9 Replies View Related

Call Function In Data Flow

Oct 15, 2007



how can you call a sql function in data flow? I have a function that calculate age base on the data in two columns . I would like to call this function in data flow to calculate the age..

View 3 Replies View Related

Cross Apply Issue (Last Call) :)

May 28, 2008

I can't figure out what can be causing this.

When I use this query

Select top 1000 a.EmployeeID,b.*
from #TmpActiveEmployeesWSeverance a
cross apply
dbo.fn_Severance_AccountItemsTable(a.EmployeeID,a.BenefitTypeID,null,null,null,null) b
order by a.EmployeeID,a.BenefitTypeID


It runs 4 seconds

If I try to insert the results into anything It runs > 5 minutes (I have yet to let it finish)

I have tried the two following pieces of code, both with the same results


Select top 1000 a.EmployeeID,b.*
into #Tmp
from #TmpActiveEmployeesWSeverance a
cross apply
dbo.fn_Severance_AccountItemsTable(a.EmployeeID,a.BenefitTypeID,null,null,null,null) b
order by a.EmployeeID,a.BenefitTypeID

--and
Insert Into TRP_ActiveEmployeesWSeverance
(EmployeeID
,PK
,BeginningBalance
,BenefitInterestRowID
,BenefitInterestID
,BenefitTypeID
,DateReceived
,InvoiceDate
,Amount
,Hours
,Fraction1
,Fraction2
,Interest
,InterestAmount
,StartDate
,EndDate
,PeriodApplied
,Offset
,Reserve
,Account
,BenefitClosedID
,PaidOut
,ClosedAccount
,ai
,ClosedDate
,StartAgain
,PartialDividend
,PartialFraction
,SameDateCount)
Select top 1000 a.EmployeeID,b.*
from #TmpActiveEmployeesWSeverance a
cross apply
dbo.fn_Severance_AccountItemsTable(a.EmployeeID,a.BenefitTypeID,null,null,null,null) b
order by a.EmployeeID,a.BenefitTypeID


Any thoughts as to what can be disrupting this?

View 5 Replies View Related

SQL Server 2014 :: Cross-database Function Call

Jul 2, 2015

I have 2 databases on the same server

One has a function, the other has the tables and views

using dba

select dbo.function(t.column) as x from dbb.dbo.table as t

gives m an invalid object name of dbo.table

using dba

select top 1 * from dbb.dbo.table works fine.

also if i create the function on the same db it works.

View 4 Replies View Related

Analysis :: How To Apply A Filter To Decide Which Formula Is Used In A Calculated Measure

May 8, 2015

The user wants to be able, using excel, to apply a filter to all measures in every measure group. I though that I can create a dimension with a single level with two members, let´s say "on" and "off" and depending on the selected member and using an IIF statement decide which formula applies to the calculated measures.

I have serious doubts about the performance and for this technique because I am thinking as a .Net developer and not as a cube developer. Maybe it is better to resolve it scoping the measures but I cannot figure it out.

View 3 Replies View Related

Global Expression Apply To All Fields In Report

Aug 17, 2007

Hi All,

I got a situation that need to write a expression for doing if the value is negtive then display () around this value, and this expression should apply to 30 fields in my report. so i just wonder is that any way that i can create this expression as global variable , then i can use this expression in each field, instead of i write IIF function in every field expression area.


Any helps are appreciated.

Cheers

Nick

View 4 Replies View Related

How To Call A Dot Net Assembly From Ssis

Jan 10, 2006

How to call a dot net assembly from ssis.

I have used a script component and went in the design script editor by clicking the "Design Script" button.From their using a object browser trying to load a dll file in references to be used in the ssis application.

But it gives error " Cannot browse the file"

 

Can any body help me in the same.

View 1 Replies View Related

Is It Possible To Create A UDF From A .NET 2.0 Assembly That Uses Dllimport To Call Unmanaged Code?

Jan 23, 2006

I have been reading up on everything I can find on this subject and I am not clear if this is allowed within the SQL Server 2005 CLR. My function calls work within a Windows form project, but don't run when invoked from a SQL function. I don't get any errors or warnings when creating the assembly and functions within SQL Server, but when running via a select statement, the spid just hangs and I have to stop & restart the service to kill the process. I have been investigating the security settings for this assembly, but I think I have that covered via the RunTime Security Policy settings in the .NET Framework 2.0 Configuration tool.



Any insights, knowledge, or thoughts would be greatly appreciated.

Barry

View 1 Replies View Related

How To Call A DotNet Assembly In SSIS Script Component

Jan 16, 2006

I tried to access a dot net assembly (.dll) file in ssis script component using following steps.


Create new Script Task in Data Flow Task
Edit Design Script button-> Loads script Project in MS VSA
Locate Object Browser
Select Custom Component Set from the dropdown and hit browse button
Browse and place the custom component dll (This Custom component dll has to be in GAC - Global assembly cache before browsing)
Select the namespace from the Component list of the object browser and click on €œAdd to references to Selected project in the solution explorer€? button
Write Imports <namespace> in the script code to invoke class methods from the .NET custom component
The following steps worked properly with June CTP version of yukon.In september CTP version of Yukon in SSIS  when i browse the dot net assembly with the same above steps i get a error stating " The file could not be browsed ".Can anybody help me in the same.
 
Prashant Utekar

View 1 Replies View Related

Filter Expression

Jul 23, 2005

HiI have some data that need to be filtered based on a SET of Id's.If it's about a single ID, then i would pass it as a parameter in astored procedure and use it within the the WHERE Clause, but here thoseID's are determined in run time and I can't simply create a a storedprocedure for an unknown amount of ID's.I looked into the SQL Server 8.0 Manual but had no examples how to usethe Function Filter.Generaly, how can filter some records based on a set of ID's?Best regards

View 1 Replies View Related

Filter Expression For Searching With All The Words

Oct 29, 2006

Using VWD I have created a search feature using the LIKE clause.  The filter expression on my SQLDataSource allows the user to search the Description field of a database and yield a result that contains the exact word or phrase entered into a textbox.  Assuming that the user enters more than one word, my understanding is that the search result is limited to database rows that contain the EXACT phrase (such as found in an advanced Google search using the “with the exact phrase” option).  The current filter expression is: Description LIKE '%{0}%' For example, if “John Smith” is typed into the search textbox, the results will include a row with: 1.  “John Smith is my neighbor”  but NOT a row with  2.  “John is my neighbor.  His last name is Smith”.   How does one modify the filter expression so that the search result is like the Google “with all the words” search option, where the search results are limited to records in which all the words typed into the textbox are present but not necessarily in the EXACT continuous order?  In the example above, BOTH Descriptions would be returned in the search results when “John Smith” in typed into the search textbox. Thanks for any help you can provide in helping me refine my search options.

View 3 Replies View Related

How Do I Use OR Condition In Table Filter Expression

Feb 11, 2008



Hai guys,

In my report I want to use OR condition instead of AND in Table Filter Expression. By default this option is disabled in VS2005 Pro. How do I enable this? or is there any other way to do this? Thanks in advance.

View 7 Replies View Related

How Do I Write An OUTER APPLY Without A Table Function?

Nov 1, 2006

I'd like to select the last unshipped order, or if none is open, the last shipped order, for each customer. I noticed that all the examples on line for OUTER APPLY involve table-valued functions, but I have read (in a book I don't have here) that a subquery can work. The following shows what I want, but it isn't valid syntax:
SELECT c.CustomerName, oa.OrderNumber, oa.Status
  FROM Customers c
  OUTER APPLY (
    SELECT TOP 1 CustomerID, OrderNumber,
    CASE WHEN ShipDate IS NULL
         THEN 'due ' + CAST(DueDate AS VARCHAR)
         ELSE 'shipped ' + CAST(ShipDate AS VARCHAR)
         END AS Status,
    CASE WHEN ShipDate IS NULL
         THEN DueDate + 1000 -- Give open orders priority.
         ELSE ShipDate
         END AS SortOrder
    ORDER BY SortOrder
              ) AS oa ON oa.CustomerID = c.CustomerID

 

View 1 Replies View Related

Can You Call/execute A Stored Procedure From An Expression?

Jun 6, 2007

I want to use Navigation to click-through to another report.

However, the source report is an MDX summary report, and the report I'm calling needs the entire Customer MDX tuple as a parameter. (the entire customer tuple is not available in my cube)

The text box has enough information to identify the customer, but not the entire tuple.

I want to pass the text box contents to a SP which returns the MDX string, and pass that to the new report.

I do not see how using another data source can help me accomplish this.

Basically, I am wondering is there a way I can have an expression similar to

=EXECUTE(spX, parm=txtbox.Value)

Thanks In Advance for any help...

View 1 Replies View Related

SQL Server 2008 :: Cross Apply With Parameterized Function?

Sep 9, 2015

I'm unable to reproduce the error. when they upgrade their OS and SQL EXPRESS to a more recent version the error disappears.

The error is: Incorrect syntax near '.'

the query in question resembles this:

Select column1, column2
from Table1 T
cross apply function(t.column4,t.column5) F
where column3 = 'XXXX'

I made sure that the compatibility level is greater than 90 this error is happening on SQL2005 SP2 as well as SQL2008 with SP2 (but not all clients are suffering from the same problem)

Can it be the .net framework? Although the machines had .net framework 3.52.

Can the OS be an issue? The OS' seem to be old, Windows Server 2008 SP2

I've tried to reproduce the error by setting up virtual machines with same OS and SQL but, again, can't reproduce.

View 9 Replies View Related

Reporting Services :: Failed To Evaluate Filter Expression Of The Grouping

Sep 23, 2015

I am trying to add a filter and sorting to a matrix, within the matrix I have a column which works out the percentage and is as follows

=(Sum(Fields!Sum_Distinct_JobBilledExVAT.Value) + Lookup(Fields!ClientId.Value, Fields!JobClientId.Value, Fields!Sum_JobBilledExVAT.Value, "ProfJobClientsFees") + Lookup(Fields!ClientId.Value, Fields!ClientId.Value, Fields!Sum_JobBilledExVAT.Value, "ProfClientsFeesID")) / (Lookup(Fields!ClientId.Value, Fields!ClientId.Value, Fields!Sum_MatchedToOtherPost.Value, "ProfClientsMatch") + Lookup(Fields!ClientId.Value, Fields!ClientId.Value, Fields!Sum_JobBilledExVAT.Value, "ProfClientsCC") + Lookup(Fields!ClientId.Value, Fields!ClientId.Value,

[Code] ....

I tried enclosing the query in Abs( ), which I have done in the past, although in the past I wasn't using Lookup functions so I don't know if that is the reason it won't work.

View 6 Replies View Related

I Want A Function Like IfNull Function To Use In Expression Builder

Jul 24, 2007

Hi,

I wonder if there a function that i can use in the expression builder that return a value (e.g o) if the input value is null ( Like ifnull(colum1,0) )



i hope to have the answer because i need it so much.



Maylo

View 7 Replies View Related

Failed To Load Expression Host Assembly. Details: The Type Initializer For 'CableReporting.Utilities' Threw An Exception

Sep 18, 2007

Hi

I am using sql reporting service 2005 with .NET 2.0.
I have created a custom dll file for report and put this dll in appropriate folder.
Report is running fine in designer project.
but when I am trying to view this report after uploading to report manager it give me an error like


Failed to load expression host assembly. Details: The type initializer for 'CableReporting.Utilities' threw an exception. (rsErrorLoadingExprHostAssembly)Is there any solution for that?

thanks and Regards

Apurv Shah
IBM India pvt Ltd

View 3 Replies View Related

Problem Creating A Function From An Assembly

Jan 5, 2007

I have compiled a dll with the following code:

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Server
Imports System.Data.SqlTypes

Public Class SICTrans

Public Shared Function TransSIC(ByVal inpSIC As String) As String
'Dim conn As SqlConnection = New SqlConnection("context connection=true")
Dim NewSIC, TempSIC, tempFSIC As String

If Len(NZ(inpSIC)) > 0 Then
TempSIC = NZ(inpSIC)

If Len(TempSIC) < 5 Then TempSIC = Left("00000", 5 - Len(TempSIC))

tempFSIC = Left(TempSIC, 2) + "." + Mid(TempSIC, 3, 2)

If Val(Right(TempSIC, 1)) > 0 Then

tempFSIC = tempFSIC + "/" + Right(TempSIC, 1)
End If
End If

NewSIC = tempFSIC

TransSIC = NewSIC

End Function
Public Shared Function NZ(ByVal input As String) As String
If Not (input Is Nothing) Then
Return input
Exit Function
End If
Return String.Empty

End Function
End Class

Which compiles fine...

i then use the following code to create the assembly in SQL which is fine:

USE NARD
GO
CREATE ASSEMBLY SICCodeTrans
FROM 'c:SICCodeTrans.dll'
WITH PERMISSION_SET = SAFE
GO

but when i goto create the function with the following code it wont have it!

CREATE FUNCTION TransSICCode(@inpSIC varchar)
RETURNS varchar
AS EXTERNAL NAME
SICCodeTrans.SICTrans.TransSIC
GO

It gives me the following error message

Msg 6505, Level 16, State 1, Procedure TransSICCode, Line 1
Could not find Type 'SICTrans' in assembly 'SICCodeTrans'.

Any ideas??????????

Thanks

Marek Kluczynski

View 6 Replies View Related

Function To Call Function By Name Given As Parameter

Jul 20, 2005

I want to write function to call another function which name isparameter to first function. Other parameters should be passed tocalled function.If I call it function('f1',10) it should call f1(10). If I call itfunction('f2',5) it should call f2(5).So far i tried something likeCREATE FUNCTION [dbo].[func] (@f varchar(50),@m money)RETURNS varchar(50) ASBEGINreturn(select 'dbo.'+@f+'('+convert(varchar(50),@m)+')')ENDWhen I call it select dbo.formuła('f_test',1000) it returns'select f_test(1000)', but not value of f_test(1000).What's wrong?Mariusz

View 3 Replies View Related

2005: Creating Aggregate Function From .NET Assembly

Jul 17, 2006

Hello,I am learning SQL Server 2005. I have (correctly) written in .NETassembly DemoSQLServer with aggregate function AvgNoMinMax in classDemo and I have added assembly to database DemoSQLServer. Now I needto create aggregate in SQL Server. I tried this way:CREATE AGGREGATE AvgNoMinMax(@v float) RETURNS float EXTERNAL NAME[DemoSQLServer].[DemoSQLServer.Demo].[AvgNoMinMax]Unfortunately I have error:Incorrect syntax near '.'.I don't know what's wrong. Please help.Thank you very much!/RAM/

View 1 Replies View Related

How To Create Assembly Function Using Dll Files In SQL Server 2005???

Aug 21, 2007

Hiiiiiiii all

I have to make a user defined function in c# as the class liberary and create a dll file, now i want to use this function in SQL Server 2005 as a part of CLR Integration

I have tried like this


CREATE ASSEMBLY abc
FROM 'C:abc.dll'

WITH PERMISSION_SET = SAFE

but it gives me
incorrect syntax error
so plzzzzz anyone help me wht to do in my probbbbbbbbb???????

Pratik Kansara

View 13 Replies View Related

ALTER ASSEMBLY Error Msg 6509 An Error Occurred While Gathering Metadata From Assembly ‘&&<Assembly Name&&>’ With HRESULT 0x1.

Feb 22, 2008

I work with February CTP of SqlServer 2008.
I have an Assembly with several UDTs inside. Version of assembly is 1.0.*
I use CREATE ASSEMBLY statement to register this assembly, and it runs without any errors. Then I rebuild CLR solution without doing any changes in source code. In that case the only difference between new and old assemblies is version (difference in fourth part of version).
Then I try to update assembly in SqlServer. I use
ALTER ASSEMBLY <name>
FROM <path>
WITH PERMISSION_SET = UNSAFE, UNCHECKED DATA
statement for this. Statement runs with error:
Msg 6509An error occurred while gathering metadata from assembly €˜<Assembly name>€™ with HRESULT 0x1.
I found the list of condition for ALTER ASSEMBLY in MSDN:
ALTER ASSEMBLY statement cannot be used to change the following:
· The signatures of CLR functions, aggregate functions, stored procedures, and triggers in an instance of SQL Server that reference the assembly. ALTER ASSEMBLY fails when SQL Server cannot rebind .NET Framework database objects in SQL Server with the new version of the assembly.
· The signatures of methods in the assembly that are called from other assemblies.
· The list of assemblies that depend on the assembly, as referenced in the DependentList property of the assembly.
· The indexability of a method, unless there are no indexes or persisted computed columns depending on that method, either directly or indirectly.
· The FillRow method name attribute for CLR table-valued functions.
· The Accumulate and Terminate method signature for user-defined aggregates.
· System assemblies.
· Assembly ownership. Use ALTER AUTHORIZATION (Transact-SQL) instead.
Additionally, for assemblies that implement user-defined types, ALTER ASSEMBLY can be used for making only the following changes:
· Modifying public methods of the user-defined type class, as long as signatures or attributes are not changed.
· Adding new public methods.
· Modifying private methods in any way.

But I haven€™t done any changes in source code, so new version of assembly satisfies all this conditions.
What could be the reason for such behavior?
P.S. I€™ve got the same error, if I add or change any method in assembly before rebuilding.

View 9 Replies View Related

Error Msg 6522, Level 16, State 1 Receives When Call The Assembly From Store Procedure To Create A Text File And To Write Text

Jun 21, 2006

Hi,
I want to create a text file and write to text it by calling its assembly from Stored Procedure. Full Detail is given below

I write a code in class to create a text file and write text in it.
1) I creat a class in Visual Basic.Net 2005, whose code is given below:
Imports System
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class WLog
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
End Sub
Public Shared Sub LogIt(ByVal logMessage As String, ByVal wr As StreamWriter)
wr.Write(ControlChars.CrLf & "Log Entry:")
wr.WriteLine("(0) {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString())
wr.WriteLine(" :")
wr.WriteLine(" :{0}", logMessage)
wr.WriteLine("---------------------------")
wr.Flush()
End Sub
Public Shared Sub LotToEventLog(ByVal errorMessage As String)
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessage)
End Sub
End Class

2) Make & register its assembly, in SQL Server 2005.
3)Create Stored Procedure as given below:

CREATE PROCEDURE dbo.SP_LogTextFile
(
@LogName nvarchar(255), @NewMessage nvarchar(255)
)
AS EXTERNAL NAME
[asmLog].[WriteLog.WLog].[LogToTextFile]

4) When i execute this stored procedure as
Execute SP_LogTextFile 'C:Test.txt','Message1'

5) Then i got the following error
Msg 6522, Level 16, State 1, Procedure SP_LogTextFile, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'SP_LogTextFile':
System.UnauthorizedAccessException: Access to the path 'C:Test.txt' is denied.
System.UnauthorizedAccessException:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, ileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.AppendText(String path)
at WriteLog.WLog.LogToTextFile(String LogName, String newMessage)

View 13 Replies View Related

Count Function To Filter

Jul 24, 2007

Guys,

I'm using the following code and I just want display all glcodes that have a count less than 2:

select glcode,
sum(abs(sysvalue)) 'Movement',
count(glcode) 'Occurances'
from jet
group by glcode
order by occurances

The following sytax works i know i need to use the where function. Does anyone know the syntax?

Cheers

Michael

View 1 Replies View Related

Function Call

Mar 28, 2006

can i make a function call from stored procedure

View 3 Replies View Related

Call A Function

Feb 26, 2008

Does anybody knows how to call a function from one VB source file to another VB source file??

I have create a MDI parent form, now i want to call the function of the child form from the parent form. Does anyone know this??

View 1 Replies View Related

Database Schemas And This Statement Has Attempted To Access Data Whose Access Is Restricted By The Assembly.

Jul 14, 2005

Hello.

View 5 Replies View Related

How To Grant Rights For The Anonymous IIS Web User IUSR_.. To Execute Scalar Function In Assembly

Jul 26, 2006

Dear all,

Basically I want to set chain up the rights so that the anonymous web user IUSR_ .. can execute the new .NET subs, functions etc in the assembly, just as the anonymous web user can execute Stored Procedures when granted. In this way, it should be possible to call the .NET assembly just as classic stored procedures from ASP/ASP.NET.

I have written a .NET function which I can successfully execute if I log on to the database as an administrator by sending this T-SQL query; it returns the result of a given string:

select dbo.CLRHTMLString('abc')

The scenario is now to try to grant access to this assembly for a different role (webuser), which the classic IUSR_MYSERVERNAME is a login of, so that I can call the .NET Assembly when I am authenticated as the anonymous web user (e.g. via ASP, etc.).

To test access, I created a login (webusertest) for a user (webusertest) in the same role (webuser) on the database. But when I use this login, which supposedly has the same rights as the IUSR_, execution right is denied:

EXECUTE permission denied on object 'CLRHTMLString', database 'adt_db', schema 'dbo'.

Note: The 'webuser' database role has Execute permission on the Assembly.

I have also tested this from my actual web page, with the following results:
(1) IUSR_MYSERVER member of db_owner role: Web page has right to call assembly.
(2) IUSR_MYSERVER not member of db_owner role: Web page does not have right to call assembly.

Further test results:
(3) Function can be called when making the user "webusertest" member of the "db_owner" role, which is too much rights to grant for the anonymous web user.

(4) When adding the user 'webusertest' to get 'Execute' permissions on the assembly, it does not get added. After clicking OK, there is no warning message, but when opening the Assembly Properties -> Permission dialog box the same time, the 'webusertest' user does not appear in the list.

Thankful for any advice on this matter.

View 4 Replies View Related

Calling VB Based SQLCLR Function Failed With Error Can't Load System.Web Assembly

Apr 20, 2007

I created a CLR function based on following VB code:



Imports Microsoft.SqlServer.Server

Public Partial Class SqlClrVB

<Microsoft.SqlServer.Server.SqlFunction()> _

Public Shared Function GetTotalPhysicalMemory() As Integer

GetTotalPhysicalMemory = My.Computer.Info.TotalPhysicalMemory

End Function

End Class



The VB code was complied into a DLL called totalmem.dll and call following TSQL to map it into a SQL function:



create assembly totalmem from '!WORKINGDIR! otalmem.dll'

WITH PERMISSION_SET=UNSAFE

go

create function fnGetTotalMem()

returns int

as external name totalmem.SqlClrVB.GetTotalPhysicalMemory

go



When I call this function, it returned following error:

select dbo.fnGetTotalMem()



Msg 6522, Level 16, State 2, Line 0

A .NET Framework error occurred during execution of user defined routine or aggregate 'fnGetTotalMem':

System.IO.FileNotFoundException: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

System.IO.FileNotFoundException:

at Microsoft.VisualBasic.MyServices.Internal.ContextValue`1.get_Value()

at My.MyProject.ThreadSafeObjectProvider`1.get_GetInstance()

at SqlClrVB.GetTotalPhysicalMemory()

.



Anyone knows why I'm hitting this error? I didn't reference any System.Web interface why it needs to load System.Web assembly? The same code runs OK if I compile it as a separate VB application out side of SQL Server 2005.



Thanks much,



Zhiqiang

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved