Function return table In SQL Sever

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
— =============================================
— Author: Name
— Create date:
— Description:
— =============================================
ALTER FUNCTION [dbo].[getSalaryFunc]
(
— Add the parameters for the function here
@date datetime
)
RETURNS
@access TABLE
(
— Add the column definitions for the TABLE variable here
card_id varchar(31),
date datetime,
salary numeric(2,1)
)
AS
BEGIN
— Fill the table variable with the rows for your result set
insert into @access
select card_id, date, salary
from Access
where date=@date
order by card_id, date
RETURN
END

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s