About 185,000 results
Open links in new tab
  1. SQL User Defined Function Within Select - Stack Overflow

    Mar 18, 2015 · If it's a table-value function (returns a table set) you simply join it as a Table. this function generates one column table with all the values from passed comma-separated list. SELECT * FROM dbo.udf_generate_inlist_to_table('1,2,3,4')

  2. sql - How to use a function in Select Query - Stack Overflow

    Apr 13, 2017 · I need to use a function in a select query. Below is my code for Function and Select Query. Sample Function: CREATE FUNCTION GetASRPlanCurrentStatus(@ChvnPlanNo nvarchar(50)) RETURNS NVARCHAR(50...

  3. sql - How to call User-defined function in SELECT statement with …

    Feb 7, 2018 · For example (if the scema is dbo), you can call the function with dbo.GetIptoCountry(): select *, dbo.GetIptoCountry(IP_address) as country from tblInfo UPDATE: According your last comment, you seems to have a table-valued function (wich returns table rows), not a scalar-valued function (wich returns a value), so the call can be done like this:

  4. sql - How to call table valued function inside select Statement ...

    Nov 28, 2014 · I have created table valued function. I am calling like this select * from dbo.fun_sample(1) It is working fine. I have table called Emp Table Emp Id Name Lname 1 Rani Kale My select Statement...

  5. Running SELECT statement inside a Function in SQL

    I am trying to use a select statement inside a function like this: CREATE FUNCTION get_Id (d DATE) RETURNS INTEGER BEGIN DECLARE @retval INTEGER SELECT id from date_store c WHERE c.start_date <= d && c.end_date >= d RETURN @retval END I am not sure if I have written this function correctly as I am not able to run it.

  6. Function SELECT that returns a row in SQL SERVER 2012

    May 30, 2017 · I want to create a function that gets the last record from my table, but it didn't work. My code is : CREATE FUNCTION GetLastReglement (@CT_Num VARCHAR(17)) RETURNS VARCHAR(17) AS BEGIN SELECT TOP (1) * FROM F_REGLEMENTT WHERE CT_Num=@CT_Num ORDER BY CT_Num DESC RETURN @CT_Num END Thanks for your help. PS: I'm novice in SQL

  7. How do I perform an IF...THEN in an SQL SELECT?

    Sep 15, 2008 · From SQL Server 2012 you can use the IIF function for this. SELECT IIF(Obsolete = 'N' OR InStock = 'Y', 1, 0) AS Salable, * FROM Product This is effectively just a shorthand (albeit not standard SQL) way of writing CASE. I prefer the conciseness when compared with the expanded CASE version.

  8. Return value from function in SQL Server - Stack Overflow

    Sep 30, 2016 · Just rewrite it like this table-valued function:. CREATE FUNCTION dbo.Get_NextSaturdayDay() RETURNS TABLE AS RETURN ( -- Add the SELECT statement with parameter references here WITH Tens AS ( SELECT 1 N UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 ), …

  9. sql - pass parameter in table valued function using select …

    Oct 24, 2013 · I have created a table valued return function which returns me a table . here is call of my function as follow . SELECT * FROM dbo.[StateFixedTaxesCalculation](3020,16,1,1006) and its working OK for me , now i want to use this function call in a select statment , so i can pass 16 which is basically employeeId dynamically.

  10. calling a function from PL/SQL in a select statement in ORACLE

    Compile the function in an appropriate schema (sames schema that will be running anonymous block) as follows: CREATE OR REPLACE FUNCTION GET_ANNUAL_COMP( sal IN NUMBER, comm IN NUMBER) RETURN NUMBER IS BEGIN RETURN (sal*12 + comm*12); END; With same schema as the function, run the anonymous block:

Refresh