Thursday, 2 April 2015

sql create function example

sql create function example :

sql create function example:



Crearte function [dbo].[fnCurrentCompanyIndustryName]
(@userId bigint)
RETURNS varchar(500)
AS
BEGIn
DECLARE @IndustryName varchar(500);
select top 1 @IndustryName=Industry.name
 From UserJob
  join Industry on UserJob.industryId = Industry.id 
  where UserJob.userId=@userId
order by startDate desc
return @IndustryName
END

No comments:

Post a Comment