mercredi 15 juin 2016

How to use user defined table type in function for return?

create type mt as table (a int, b int)

Below function works:

create function fn2()
returns @mt table (a int, b int)
as 
begin 
insert into @mt 
Select 1, 2 
return
end 

Below does not work:

create function fn2()
returns @mt table mt
as 
begin 
insert into @mt 
Select 1, 2 
return
end 

Any comments on how type 'mt' can be used for return type?

Aucun commentaire:

Enregistrer un commentaire