You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/word/新协航_设计文档/数据库建表文档/20140215/函数_计算合同重量.sql

23 lines
563 B
MySQL

3 years ago
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[F_weight_SUM]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[F_weight_SUM]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create function [dbo].[F_weight_SUM](@Contractno varchar(50))
returns numeric(18,3)
as
begin
declare @S numeric(18,3)
select @S=isnull(@S,0)+convert(numeric(18,6),[weight]) from import_cargo where Contractno=@Contractno
return @S
end
GO