Questions tagged [user-defined-functions]

A function provided by the user of a program or an environment most often for spreadsheet type applications or database applications. Use [custom-functions-excel] for Excel and [custom-function] for Google sheets. Specify a programming language tag as well: [google-apps-script], [javascript], [sql], [tsql], etc. as well as a tag for the application: [excel], [google-spreadsheet], [sql-server] etc.

In the context of a programming language or an environment, a User Defined Function (UDF) is a function that is created by a user to perform a specific task (as opposed to a function that is intrinsic to the environment, built into the programming language or environment).

Spreadsheet applications like Excel and Google Sheets calls these "custom functions".

Microsoft also uses the term User Defined Functions with . The tag may also be applicable. See What is the need for user-defined functions in SQL Server?

Use:

4875 questions
2
votes
2 answers

Excel UDF Filter Range

I have a function that takes a range of values as input (just a column) as well as some threshold. I would like to return a range that is filtered to include all values from the original range that are greater than the threshold. I have the…
2
votes
1 answer

Pass an array argument to custom pig loader

I wrote a LoadFunc function that allows me to select given keywords of an unstructured huge log-file. How do I pass Tuple into my function as an argument? Something like A = load '/input/*' using MyLoader('keyword1','keyword2'); or A = load…
2
votes
0 answers

Generating dbcontext with sqlmetal creates my table value UDF columns as nullable

I've created a inline table UDF which have some various columns of different types. ALTER FUNCTION [dbo].[fnTest]() RETURNS TABLE AS RETURN ( SELECT [t0].[type], [t0].[status], [t0].[createdDate], -- datetime not…
2
votes
1 answer

SQL Server : table-valued function does not work with sub query

I have a SQL Server table-valued function which is created by me I have pasted the create script below CREATE FUNCTION [dbo].[getTableFromString] ( @String AS nvarchar(max) ) RETURNS @ReturnTable TABLE ( StringValues nvarchar(10) ) …
2
votes
2 answers

SQL User defined function, can't find dbo or user-defined function

I have created a function in my database using this query: CREATE FUNCTION dbo.fnSplit( @sInputList VARCHAR(MAX) -- List of delimited items , @sDelimiter VARCHAR(MAX) = ',' -- delimiter that separates items ) RETURNS @List TABLE (item…
Mahdi Ghiasi
  • 14,873
  • 19
  • 71
  • 119
2
votes
1 answer

Passing empty list to user defined table type parameter on a scalar function

So I have this user-defined table type parameter, which is used in my scalar function and might be empty. I've read this topic about passing empty list to table-valued parameter on a stored procedure: Binding empty list or null value to table valued…
2
votes
1 answer

Deterministic scalar function to get week of year for a date

Here is a great way of how to get day of week for a date, Deterministic scalar function to get day of week for a date. Now, could anyone help me to create a deterministic scalar function to get week of year for a date please? Thanks.
Irawan Soetomo
  • 1,315
  • 14
  • 35
2
votes
2 answers

precomputing user-defined functions in postgresql

I'm trying to precompute a user-defined function on a per row basis. The idea is I have JSON object as a text object in one of the fields, and I want to parse out some other 'fields' from it, which can be returned in queries just like any other true…
2
votes
1 answer

Using UDF in SELECT statement

I made a user-define function for business hours calculation. This is my UDF. CREATE FUNCTION fn_GetBusinessHour (@date datetime, @addHours int) RETURNS datetime AS BEGIN DECLARE @CalcuatedDate datetime; DECLARE @addDayCount int,…
Stonpid
  • 349
  • 1
  • 3
  • 14
2
votes
1 answer

Python: have a user-defined function as an input while keeping the source-code inaccessible?

I need to write a piece of software that takes a user-defined function (written in python) as an input. The user-defined function takes a vector of numbers and returns a vector of numbers. My software will call this user function many times (in…
Yulia V
  • 3,507
  • 10
  • 31
  • 64
2
votes
1 answer

TSQL IVF causing timeout in ASP.net application

Hi and thanks for your attention. First some background on the question: I have an Inline Table Function which is used ubiquitously throughout an ASP.net application I have developed, running on IIS7. It's the basis for 30 or more stored…
mrmillsy
  • 495
  • 3
  • 14
2
votes
4 answers

How do i load an automation addin (dll) programmatically from within a vsto addin

VSTO VS2008 SP1 .NET 3.5 Excel 2007 I am a .net noob. I am trying to load an automation addin that is an excel application/automation addin (it is a dll not xla or xll) from within a vsto addin in the ThisAddIn_Startup() method of the vsto addin.…
Buki
  • 21
  • 1
  • 3
2
votes
1 answer

Can a user defined function be used in the discriminator formula in Hibernate

I've created a user defined function in hibernate called bitwiseAnd, and registered it in the dialect constructor as follows: public SQLServerDialect() { super(); registerFunction("bitwiseAnd", new SqlBitwiseFunction("bitwiseAnd",…
Ruaghain
  • 135
  • 1
  • 14
1
vote
1 answer

sql server udf, return the same type as the input expression

is it possible for a udf to return the same data type as one of its parameters? i would like my udf to accept a decimal of any precision and scale and return the same type.
Ben
  • 462
  • 2
  • 12
1
vote
1 answer

Mounting HFS+ and UDF from a Hybrid Video-DVD

I have developed a Mac software (using DiscRecordingFramework and IOKit) that creates hybrid Video-DVD. The resulting DVD is fully compatible with Video-DVD specifications. The hybrid disc hosts HFS+, UDF and ISO filesystems. Now the problem is Mac…