代码如下: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[f_WorkDay]’) and xtype in (N’FN’, N’IF’, N’TF’)) drop function [dbo].[f_WorkDay] GO –计算两个日期相差的工作天数 CREATE FUNCTION f_WorkDay( @dt_begin datetime, –计算的开始日期 @dt_end datetime –计算的结束日期 )RETURNS int AS BEGIN declare @i int select