SQL 函数

CREATE FUNCTION GetInStockIDByMaterialID(@materialID NVARCHAR(50))
RETURNS int
AS
BEGIN
DECLARE @userId int
IF @materialID IS NULL
RETURN NULL
SELECT @userId=B.UserID
FROM dbo.wh_WareHouseRefCategory AS A INNER JOIN dbo.wh_WareHouseRefUser AS B
ON A.WareHouseID=B.WareHouseID AND A.CategoryID=SUBSTRING(@materialID,1,8)
RETURN @userId
END
GO

SQL 函数,布布扣,bubuko.com

SQL 函数

上一篇:附加数据库报错:无法打开物理文件 XXX.mdf",操作系统错误 5:"5(拒绝访问。)"


下一篇:c++中sqlite中文路径创建数据库失败的问题