如下,偶建立了一个函数,但是无法执行,请教各位老大,如何解决
CREATE function checkIPOK (@tmpIP varchar(18),@tmpTime varchar(10)) returns smallint
AS
--'192168001167','2006-08-09'
begin
declare @tmpNum1 smallint
select @tmpNum1=count(*) from DenIPList where @tmpIP>=IPFrom and @tmpIP<=IPTo
if @tmpNum1=0
begin
select @tmpNum1=count(*) from VistIPList where create_time>@tmpTime and ip=@tmpIP
end
else
begin
return @tmpNum1
end
return @tmpNum1
endselect dbo.checkIPOK('192168001123','2006-08-25 00:00:00')服务器: 消息 208,级别 16,状态 1,行 1
对象名 'dbo.checkIPOK' 无效。
CREATE function checkIPOK (@tmpIP varchar(18),@tmpTime varchar(10)) returns smallint
AS
--'192168001167','2006-08-09'
begin
declare @tmpNum1 smallint
select @tmpNum1=count(*) from DenIPList where @tmpIP>=IPFrom and @tmpIP<=IPTo
if @tmpNum1=0
begin
select @tmpNum1=count(*) from VistIPList where create_time>@tmpTime and ip=@tmpIP
end
else
begin
return @tmpNum1
end
return @tmpNum1
endselect dbo.checkIPOK('192168001123','2006-08-25 00:00:00')服务器: 消息 208,级别 16,状态 1,行 1
对象名 'dbo.checkIPOK' 无效。
AS
--'192168001167','2006-08-09'
begin
declare @tmpNum1 smallint
select @tmpNum1=count(*) from DenIPList where @tmpIP>=IPFrom and @tmpIP<=IPTo
if @tmpNum1=0
begin
select @tmpNum1=count(*) from VistIPList where create_time>@tmpTime and ip=@tmpIP
end
else
begin
return @tmpNum1
end
return @tmpNum1
end
go
select dbo.checkIPOK('192168001123','2006-08-25 00:00:00')
go
AS
--'192168001167','2006-08-09'
begin
declare @tmpNum1 smallint
select @tmpNum1=count(*) from DenIPList where @tmpIP>=IPFrom and @tmpIP<=IPTo
if @tmpNum1=0
begin
select @tmpNum1=count(*) from VistIPList where create_time>@tmpTime and ip=@tmpIP
end return @tmpNum1
end
go ---主要加这里select dbo.checkIPOK('192168001123','2006-08-25') --太长了,最好改用datetime