
tsql returning a table from a function or store procedure
Jun 30, 2011 · You need a special type of function known as a table valued function. Below is a somewhat long-winded example that builds a date dimension for a data warehouse. Note the returns clause that defines a table structure.
Update Data via a Table-Valued Function in SQL Server - Database…
Feb 6, 2020 · In SQL Server, it’s possible to update data via a table-valued function. What I mean is, you can update data in the underlying tables that the function queries. For example, if your function returns someone’s first name from a table, you can update their first name by running an UPDATE statement against the function instead of the table.
SQL Server Table-Valued Function By Practical Examples
This tutorial introduces you to SQL Server table-valued function including inline table-valued functions and multi-statement table-valued functions.
UPDATE (Transact-SQL) - SQL Server | Microsoft Learn
Jan 29, 2025 · Changes existing data in a table or view in SQL Server. For examples, see Examples. Transact-SQL syntax conventions. UPDATE . [ TOP ( expression ) [ PERCENT ] ] . { { table_alias | <object> | rowset_function_limited . [ WITH ( <Table_Hint_Limited> [ ...n ] ) ] . | @table_variable . SET .
SQL Server function return table - DatabaseFAQs.com
Jan 29, 2025 · In this SQL Server tutorial, we will learn about the SQL Server function return table. We will illustrate this topic using multiple examples. In this section, we will learn how to create a user-defined function in SQL Server that returns table-type data. For this task, first, we need to know about user-defined functions in SQL Server.
Inline Table Valued Function in SQL Server - GeeksforGeeks
Mar 3, 2023 · In SQL Server, an Inline Table-valued function (ITVF) is a user-defined function that returns a table as its result. Unlike a scalar function that returns a single scalar value, an Inline Table Valued Function returns a result set that can be used in a query just like a table.
SQL UPDATE Statement - W3Schools
WHERE clause in the UPDATE statement. The WHERE clause specifies which record (s) that should be updated. If you omit the WHERE clause, all records in the table will be updated! Below is a selection from the Customers table used in the examples: 120 Hanover Sq.
Update Within a SQL Server Function - Stack Overflow
Aug 26, 2013 · I have a SQL Server function that gets a nextID from a table. That is straight-forward enough, but I also want to update the table for the ID used. I am using the technique to update into a table, but the update just isn't happening.
SQL Server multi-statement table-valued functions - SQL Shack
Sep 11, 2019 · The return table (@ResultTable) contains ProductName, ScrapQty, ScrapReasonDef, and ScrapStatus columns and this table will be populated and updated in the function body according to the parameter value. Finally, it returns the output table as a resultset.
Possible to use a function as part of an update query? - SQLServerCentral
Jul 11, 2011 · You can't use the UPDATE statement inside a function unless the UPDATE statement is directed to a table variable local to the function.