Trying to deploy Write UDF in DDT


Author
Message
Geoff Hirst
Geoff Hirst
StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Guys,

A simple UDF, that I need to return a date based on some info in my DB, I wanted this as a UDF, which I have written and tested in SQL Server, works fine.

What I can't do is get the DDT to deploy it. I know my issue lies in the first 2-3 lines, but I really don't know what it might want.

Can anyone send me a translation of how it should be put into the DDT?

thanks in advance

G.

UDF is as follows

CREATE FUNCTION [dbo].[FirstDayHolidayYear]()

RETURNS smalldatetime

AS

BEGIN

-- Declare the return variable here

DECLARE @Year CHAR(4)

DECLARE @Month VARCHAR(2)

DECLARE @Day VARCHAR(2)

SELECT @year = YEAR(GETDATE())

SELECT @day = '01'

IF (SELECT annualleaveyearstart FROM dbo.ApplicationSettings)<10

SELECT @Month = '0'+CAST(annualleaveyearstart AS CHAR(1)) FROM dbo.ApplicationSettings

ELSE

SELECT @month = CAST(annualleaveyearstart AS CHAR(2)) FROM dbo.ApplicationSettings

BEGIN

-- Insert statements for procedure here

return (CAST(@year+'-'+@month+'-'+@day AS SMALLDATETIME))

END

END


Geoff Hirst
Geoff Hirst
StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)StrataFrame User (171 reputation)
Group: Forum Members
Posts: 123, Visits: 3.5K
Guys,

No need to respond. I had a brainwave and ran a profiler session to see what YOU send it. Once I had this, all I needed to add was (), as I have no parameters for this function.

sorry for the hassle.

best

G.

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (484 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Glad you got it figured out Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search