Home > php教程 > PHP开发 > A brief discussion on the difference between return and returns in sql

A brief discussion on the difference between return and returns in sql

高洛峰
Release: 2016-12-14 13:00:42
Original
2797 people have browsed it

1: In a user-defined function, use the RETURNS clause to specify the data type of the function’s return value

Example:

CREATE FUNCTION dbo.f_getdate(
@year int,  --The year to be queried
@bz bit                                                                                                              bz=0 Query working days, @bz=1 Query rest days, @bz IS NULL Query all dates
)RETURNS @re TABLE(id int identity(1,1),Date datetime,Weekday nvarchar(3))
,, ,

2: return is used to return specific values/value variables

create procedure InsertNewCategory @CategoryName varchar(50), @ParentID int as INSERT INTO BookCategory(CategoryName,ParentID) values ​​(@CategoryName,@ParentID) return

The result is:

if @@error <>0
return -1 --failure
else
return 1 --success


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template