0
我創建主數據庫下面的函數,因此您可以 運行的代碼正確地複製它沒有問題存儲函數返回NULL
ALTER FUNCTION [dbo].[sf_GetDateAggioGAP]
(@name varchar,@type_desc VARCHAR)
RETURNS DATETIME AS
BEGIN
DECLARE @RESULT DATETIME
DECLARE @DATA DATETIME
DECLARE @RIPETI INT
SET @DATA = (SELECT DISTINCT create_date as DATINI FROM sys.all_objects WHERE (name = @name) AND (TYPE_DESC = @type_desc))
SET @RIPETI = (SELECT DISTINCT OBJECT_ID as RIPETI FROM sys.all_objects WHERE (name = @name) AND (TYPE_DESC = @type_desc))
SET @[email protected]
WHILE @DATA <= getdate()
BEGIN
SET @DATA=dateadd(month,@RIPETI,@DATA)
IF @DATA > GETDATE()
BREAK
ELSE
CONTINUE
SET @[email protected]
END
RETURN @RESULT
END
當我打電話給我的功能以這種方式"select dbo.sf_getdateaggiogap('sysrscols','system_table') as datanext from sys.all_objects where name ='sysrscols'"
結果總是空,但查詢的結果始終爲空。 我在哪裏錯了?
THANKS
您對 – Geert
沒有一個良好的開端你的CapsLock鍵。用'Capslock On'寫作就像大聲呼喊 – Steve
我真的很抱歉。無論如何感謝 – user1921306