起初,对不起我的英语太糟糕了
我坚持在java中的sql server上调用我的函数。
这是我在 sqlserver 中的代码:
GO
IF OBJECT_ID (N'GET_DATE', N'FN') IS NOT NULL
DROP FUNCTION GET_DATE;
GO
CREATE FUNCTION GET_DATE()
RETURNS CHAR(12)
AS
BEGIN
DECLARE @NO_ORDER CHAR(12), @NO_ORDER_MAKS INT
declare @noSPK char(16),@noSPKmaks int;
if (exists(select * from orders_spp))
begin
SELECT @NO_ORDER_MAKS = MAX(CONVERT(INT,(SUBSTRING(NO_ORDER,7,4)))) from
ORDERS_SPP;
SET @NO_ORDER = CONVERT(CHAR(2),
(right(datepart(year,getdate()),2))) +
'-' +
RIGHT('0' + CAST(month(getdate()) as varchar(2)),2) +
'-' +
REPLICATE('0',4-LEN(CONVERT(varchar(30),@NO_ORDER_MAKS)))+
CONVERT(varchar(30),@NO_ORDER_MAKS+1) +
'/' +
'P';
end ;
else
set @NO_ORDER = CONVERT(CHAR(2),(right(datepart(year,getdate()),2))) +
'-' +
RIGHT('0' + CAST(month(getdate()) as varchar(2)),2) +
'-' +
'0001/P';
RETURN @NO_ORDER;
END;
GO
SELECT dbo.GET_DATE() AS 'RESULT'
我应该输入什么命令来调用java中的函数?请帮助我,谢谢:)