udf

Calling a UDF in LINQ without "dbo" database user

Hi every one! I am using LINQ to call a function named "GetTabMenuTheme", I dragged it in the Database Model to generate the function like this: [Function(Name="dbo.GetTabMenuTheme", IsComposable=true)] public string GetTabMenuTheme([Parameter(DbType="NVarChar(MAX)")] string state) { return ((string)(this.ExecuteMethodCall(this, ((...

What's the difference between "::" and "sys" schemas?

As far as I know, BOL exmaple on fn_trace_getinfo used to use :: instead of sys schema in the example like following From SELECT * FROM ::fn_trace_getinfo(default) To SELECT * FROM sys.fn_trace_getinfo(default) Are there any differences between those two? And what does :: mean? ...

How to properly compile C++ UDFs on Snow Leopard for MySQL

I am trying to install a Levenshtein UDF for MySQL but I am having a ton of problems, I think mainly because of the lack of documentation for Macs. The specific UDF I am using is this one: http://joshdrew.com/mysql%5Flevenshtein%5Fudf-1.0.tar.gz and is done in C++. So far, I have gotten successful compilation using: g++ -Wall -bundle -...

How to refresh the definition of a T-SQL user-defined function after a dependent object is redefined?

Consider the following sequence of events: A view v_Foo is defined A user-defined function GetFoo() is defined that includes all columns from v_Foo (using 'Select * ...') The definition of v_Foo changes and now includes more columns I now want GetFoo() to include the new columns in v_Foo, but it still references the old definition I ...

Doing an INSERT from a C DB2 scalar UDF

Is it possible to do an INSERT statement inside a scalar C-language UDF in DB2? I know it sounds weird to have an UDF with side effects like this, but there's a good reason for it. ...

Select all UDFs from database?

Something like: SELECT * FROM sys.functions ...

How to determine which DLL an Excel UDF is coming from ?

Hello, is there any way to determine from an Excel session, which DLL an UDF is coming from ? I have a bunch of DLLs loaded by default, I wanted to determine for every UDF where it was defined. If the UDF was not defined in a DLL but via VBA, is there a way to determine in which XLA or XLS it was defined ? Thanks very much for taking...

Need help with SQL join to a function

Hello! I am trying to enter the following to an UPDATE trigger of QuoteItem: UPDATE QuoteItem SET List = StyleItem.List, CostFactor = StyleItem.CostFactor, Cost = NULL FROM dbo.fn_GetQuoteItemListPrice(QuoteItem.ItemId, QuoteItem.RoomId) AS StyleItem CROSS JOIN (QuoteItem JOIN INSERTED ON QuoteItem.QuoteItemId = INSERTED.Quot...

Can a java application manage triggers and UDFs in Derby database ?

Can we manage UDFs, and triggers in Derby database from our own Java Application ? By managing I mean : checking if it exists; adding; removing. ...

T-SQL UDFs, try-catch

Why doesn't SQL Server support TRY-CATCH blocks inside UDFs? If we're talking about scalar UDFs, which are mostly used for calculations and conversations, this block should be heavily used, but we don't have it. Also, what workarounds do you use for this? ...

Problem using a UDF as computed col: Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

Hello. My question is a little subjective and might be a little unclear since I don't know where in the UDF crashes, or whether the error is caused in the function itself or from other resources using a column in this table. Let me just tell you the story. I had a function (that used as a computed-column for QuoteItemsGroupFeature.Sal...

sybase user defined function - "non deterministic" or "illegal built-in function" error

When trying to create a user-defined functions (UDFs) on sybase 15+, you may get the following error: "illegal built-in function statement in scalar SQL function" This is b/c "non deterministic" functions such as getdate(), rand(), newid() are not allowed in UDFs. Is there a way around this limitation? Note that I plan answer my own qu...

Bizarre performance issue: Common Table Expressions in inline User-Defined Function

Here's a brain-twister for the SQL guys - can anyone think of a reason why the first of these functions performs fine, and the second one runs dog-slow? Function A - Typically finishes in ~5 ms CREATE FUNCTION dbo.GoodFunction ( @IDs UniqueIntTable READONLY ) RETURNS TABLE AS RETURN SELECT p.ID, p.Node, p.Name, p.Level FROM...

hash functions-sql studio express

I need to create a hash key on my tables for uniqueness and someone mentioned to me about md5. But I have read about checksum and binary sum; would this not serve the same purpose? To ensure no duplicates in a specific field. Now I managed to implement this and I see the hask keys in my tables. Do I need to alter index keys originally cr...

PostgreSQL insert that depends on data in another table, best practice?

I've recently started using PostgreSQL and I'm trying to do things "the right way" as I've understood it. Meaning putting as much work in the database server instead of on the client as possible. So I've created a function with PL/pgSQL that will add data to a table. Since I've a primary key constraint set on that table, and the referen...

Deploying an Excel UDF

I have an excel UDF that calls a web service . The UDF code is an automation addin code which is a C# class library and I created an installer for it. When I run the set up, no reference to the particular addin code appears in the toos-->addins-->automation addins list of excel and the function does not apepar in the formula bar. I am us...

Reporting Services: Creating user defined functions in report query. Is it real?

Is it possible to create and use a user defined function in a report query? Something like this: if OBJECT_ID('userFunc', 'TF') is not null drop function userFunc go create function userFunc(@id int) returns @tbl table ([id] int) begin insert into @tbl (id) values(@id) return end go select * from userFunc(1) if OBJECT_ID('userFunc',...

I'm using SQL UDF's to encapsulate simple reporting/business logic. Should I avoid this?

I'm building up a new database in SQL Server 2008 for some reporting, and there are many common business rules pertaining to this data that go into different types of reports. Currently these rules are mostly combined in larger procedural programs, in a legacy language, which I'm trying to move over to SQL. I'm shooting for flexibility...

Using F_RoundToEven FreeAdhocUDF function fails with some numbers

I have noticed that when we use F_RoundToEven UDF from FreeAdhocUDF, that it fails to produce a correct result with certain numbers. For example, the query: select F_RoundToEven(21.145, 2) Correct, F_RoundToEven(215.145, 2) Fail from Rdb$Database produces the result: CORRECT FAIL 21.14 215.15 Obviously these two number shoul...

Excel UDF formula does not appear.

Hi , I have an Excel UDF . It is written in C# and the automation addon has been packaged using the Visual Studio setu up project wizard. The addon loads in the list of automation addons available but the formula does not appear in the Insert function formula dialogue box. I used Office 2003 and Visual Studio 2008 to build the addin. T...