StrataFrame Forum

Trying to deploy Write UDF in DDT

http://forum.strataframe.net/Topic18399.aspx

By Geoff Hirst - 8/11/2008

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

By Geoff Hirst - 8/11/2008

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.

By Dustin Taylor - 8/11/2008

Glad you got it figured out Smile