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
1
vote
1 answer

How to use function to connect to database and how to work with queries?

I am using functions to work with database.. Now the way i have defined the functions are as follows:- /** * Database definations */ define ('db_type', 'MYSQL'); define ('db_host', 'localhost'); define ('db_port', '3306'); define ('db_name',…
Django Anonymous
  • 2,987
  • 16
  • 58
  • 106
1
vote
3 answers

JSON Array field handling in Elephant-Bird UDF in PIG

A quick question on the JSON handling in PIG. I tried some JsonLoader called Elephant-Bird to load and handle JSON data like the followings: { "SV":1, "AD":[ { "ID":"46931606", "C1":"46", "C2":"469", …
kee
  • 10,969
  • 24
  • 107
  • 168
1
vote
0 answers

Calling a Web Service from MySQL?

I'd like to call web service from a MySQL trigger every time a record is inserted. At the moment I'm testing UDF and gSOAP. I've done a small test and it seems to work, but I was wondering if there wasn't a simpler way to do this.
ilitirit
  • 16,016
  • 18
  • 72
  • 111
1
vote
2 answers

add_action('wp_head") cannot adding styling to head

I have the following php code: add_shortcode("hello","hello_func"); function hello_func(){ add_action("wp_head","styles"); add_action("wp_footer","scripts"); } function styles{ echo ""; } function scripts{ …
Jordan Halaby
  • 11
  • 1
  • 2
1
vote
1 answer

How to VBA caching xmlhttp request returned value?

I want to cache xmlhttp request 's returned value so as NOT to wait too long when calling hundreds of such request. I have tried caching values in Array/Collection but when Excel closed and reopened later, all caches are lost! Update I call…
Davuz
  • 5,040
  • 13
  • 41
  • 61
1
vote
1 answer

table value function using entity framework‬

I'm working with SQL trying to implement a Full-Text-Search. I noticed that there is no direct handling to Full-Text-Search in Linq. I've read that I can use UDF that will return a table. I tried using that but EF doesn't recognize my functions,…
mashta gidi
  • 849
  • 1
  • 10
  • 30
1
vote
1 answer

Calling Inline UDF with table alias.column name as a parameter

I have a Inline table valued Function that i want to pass a column from a select but will use a table alias. For Example: select top 1000 a.*, b.* from item a LEFT JOIN itemList b on a.item_id = b.item_id where a.item_id in (SELECT * FROM…
Jdunn5
  • 108
  • 2
  • 10
1
vote
3 answers

need some help optimizing a stored proc

I have a stored procedure which is building a dynamic sql query and then running it via exec(@sql). The stored proc is joining about 12 tables. As it was, it was running relatively quickly. But then i needed to added in an additional field. To do…
merk
  • 1,721
  • 5
  • 23
  • 39
1
vote
2 answers

Using Variable with function - SQL

I have custom function which return a table it accepts two varchars, it splits the varchar based on the delimeter SELECT VALUE FROM dbo.Split('xxx','_') --- working select abc from abcd a,cde b where a.abc like (SELECT VALUE FROM…
1
vote
0 answers

SQLite - user defined function to work with relational data

The SQLite database I'm working on stores named polygons, each consisting of some points, the tables are "polygons" (id, name) and "points" (x, y, polygon_id). Now, given a point coordinates, I need to query all the polygons which are intersected by…
migajek
  • 8,524
  • 15
  • 77
  • 116
1
vote
1 answer

Postgres dllimport like SQL Server

Is there any similar thing like SQL Server's UDF (where a function can be exported in a DLL and imported as a function in SQL Server) in Postgres? For example the function I want to import has the following signature: public static extern double*…
edgarmtze
  • 24,683
  • 80
  • 235
  • 386
1
vote
3 answers

Using functions in sql query

I structured my sql table like this: ItemID Price MaxPeople CalculationUnit 1 10 4 people/item 2 70 2 item 3 30 8 week/item 4 50 2 week etc. Now I would…
mko
  • 6,638
  • 12
  • 67
  • 118
1
vote
1 answer

Return Different Data Types in C Function

I am having the following situation: void func () { TEST_MACRO(....., ret_type) .......... } some_ptr* func2() { TEST_MACRO(....., ret_type) .......... } int func3() { TEST_MACRO(....., ret_type) .......... } I am having 3…
Sandeep Singh
  • 4,941
  • 8
  • 36
  • 56
1
vote
3 answers

SQL Server 2008 - UDF Parameter Types And Return Types

I often stumble at the following while writing UDFs in SQL 2008. Please tell me whether my following assumptions are right or wrong. A UDF can return Data Table. But a UDF can't receive a Data Table as a parameter. A UDF can receive an…
1
vote
4 answers

How to match two email fields where one contains friendly email address

One table has "John Doe " while another has "jdoe@aol.com". Is there a UDF or alternative method that'll match the email address from the first field against the second field? This isn't going to be production code, I just need it for…
iamgoat
  • 400
  • 1
  • 4
  • 11