A function defined in a relational database system. Most RDBS's include numerous built-in functions and also allow for the creation of additional custom functions.
Questions tagged [sql-function]
908 questions
-1
votes
1 answer
How To display different features values for same Feature Name on one row separated By Stick?
I work with SQL Server 2012 and I face an issue: I can't get all different values feature on one row result, separated by sticky if it multiple difference.
If only one is different, then no need stick.
I actually need to display feature value for…

ahmed barbary
- 628
- 6
- 21
-1
votes
3 answers
Searching strings in sql Column and need to split required string with prefix
I have a table and having two columns account and rt_exclude.I need to select only the word "exclusion" from the rt_exclude column with the prefix.The rt_exclude column contains many rows with different length so i dont want to use case…

Rajeev
- 5
- 2
- 8
-1
votes
1 answer
How to update status for part with nothing data when this part is missed?
I work with SQL Server 2012 and have an issue: I can't update status with No data returned where no result returned from select statement cross apply function.
Meaning where no data returned when join parts and company to function then update status…

ahmed barbary
- 628
- 6
- 21
-1
votes
3 answers
Splitting a Sentence and select only required string in sql
I have column in my table named billing_cycle which contains only below given two strings and i need to retrieve only monthly and Quarterly from that string.
Using the below query i can fetch string Quarterly properly but not string monthly.In the…

Rajeev
- 5
- 2
- 8
-1
votes
2 answers
How to update status to wrong numeric if at least on character exist?
I work on SQL server 2012 I have issue I can't update status to Numbers only when whole field have digits only from 0 to 9 .
but if it have only one character or precision then it will be not valid .
1222 valid
223g not valid
create table…

ahmed barbary
- 628
- 6
- 21
-1
votes
1 answer
How to get max Value Unit from field Value Unit based on first value before comma separated?
I work on SQL server 2012 I face issue :i can't get first max value from value Unit based on First value before comma .
as example This value Unit below :
1.89, 2.625, 3.465
I will get first value before comma separated as 1.89 then if this number…

ahmed barbary
- 628
- 6
- 21
-1
votes
1 answer
How to split symbol data field on temp table to 5 columns?
I work on a SQL Server 2012 query, an I face an issue: I can't split temp table field symbol data to 5 columns.
How to do that please?
CREATE TABLE #TEMP
(
id INT IDENTITY(1,1),
SymbolData NVARCHAR(50)
)
INSERT INTO #TEMP…

ahmed barbary
- 628
- 6
- 21
-1
votes
1 answer
Function that calculates number of days between 2 dates, accepts the start date and end date, then returns how many days it covers over that period
I have to do something similar to this, and I need to spool file as well to css
CREATE OR REPLACE FUNCTION NumberOfDays
(in_date IN DATE)
RETURN NUMBER
IS
days NUMBER;
BEGIN
days:= TRUNC(SYSDATE - in_date);
EXCEPTION
WHEN OTHERS…

Peter Petrovski
- 3
- 3
-1
votes
1 answer
MySQL - how to fix function creation error 1418
Im using mysqlWorkbench
I have followed example work supplied by my tutor and suggestions from other users on this sight but am now recieving a 1418 error when trying to create the function, as shown in the following:
Error Code: 1418. This…

null.ts
- 33
- 1
- 6
-1
votes
2 answers
Why is this function not being created?
Trying to create a function that takes in a month(1-12) and returns the productID that has the highest sales(qtyordered * quoted price).
The error: PL/SQL: ORA-00936: missing expression, coming from the sub-query in the where clause.
I'm assuming…

bender_matt
- 11
- 5
-1
votes
1 answer
SQL server function how to use parameter to in query
my sql function is not working parameter value. If provide hard code value it will give me results.
ALTER function [dbo].[team_concat] (@input varchar)
returns varchar(8000)
as
BEGIN
declare @putout varchar(8000)
set @putout = null
-- select…

Suresh Kamrushi
- 15,627
- 13
- 75
- 90
-1
votes
1 answer
How will I achieve the following requirement using sql function or query
How will I write a sql function for the below requirements
I have a temp table table1 with all columns of int type
table1
scoreA | scoreB | scoreC | classA |classB | classC |
suppose I have another temp table2 table with both…

krity
- 49
- 3
- 7
-1
votes
1 answer
SQL Scalar function running long time from stored procedure
Below scalar function called from stored procedure.but The stored procedure
running very slow. I
dont know what mistake i have done below function.Please help me to find what
mistake done. Thanks in advance.
CREATE FUNCTION…

CSK
- 777
- 7
- 17
-1
votes
1 answer
Column metadata query with aggregate on column contents
I'm trying to write a metadata query (sys.tables and sys.columns) that also contains an additional column with an aggregate on that column's data. The output I'm looking for will be a table with these…

user9211266
- 1
- 1
-1
votes
2 answers
Count items in comma-delimited SQL column
I have a movie database that has the cast field as a comma delimited column as shown below.
What I would like to accomplish is to get a count of how many movies each cast member has in the database. The cast field is of different lengths
As in
…

Tony Springs
- 85
- 7