Actual Practice : Table Valued Functions in my work -3

来源:互联网 发布:淘宝大学免费帐号 编辑:程序博客网 时间:2024/05/16 11:06
  1. Table Valued Functions
    Let us have a look a example:
........ALTER FUNCTION [dbo].[GetDetails]  (    @INPUTSQL VARCHAR(MAX)  )  RETURNS  @A TABLE  (    ID INT IDENTITY(1,1),    Details VARCHAR(50)  ) BEGIN     .......

Look at : The “Returns” is ‘Table’ which means this funciton will return a table. This table has 2 column ‘ID’ and ‘Details’. Then we can use below sql to get one of the value of those two.

Select * from [dbo].[GetDetails](@ID) --we can fill with one value of "ID"

Now we must clear that: what in the () must be one of those two column on the other words is : we must not fill all the value of columns.

You can make some correspond changes if we have three or more parameters in the funciton.

0 0
原创粉丝点击