Showing posts with label feed. Show all posts
Showing posts with label feed. Show all posts

Monday, March 19, 2012

date function/tool to determine future business days/ holidays

Hi,

Does SQL server 2005 provide a function to determine future BUSINESS day ? What about holidays ? I sthere a way to feed a holiday file into a table and have SQL Server determin if the future date falls on a business day ?

As far as you do not mean the fixed calculated public holidays (like Easter, which can be calculated with a Gauss formula) you will have to implement that on your own having a custom table with the special dates.

Jens K. Suessmeyer


http://www.sqlserver2005.de

|||

Thanks but I am still unclear. If I'd like to know if today's date + 100 days from now would fall on a business day . Is there a ready-to-use MS SQL function that I can use or should I write it on my own ?

|||

Well, define business day. There is not a common understanding of business day (even in one countrym like here in Germany :-) )

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Hello. I think the following library of functions can help with the issue of finding Business Days:

http://www.SQLsharp.com/

I just added some date functions and one of them is finding the number of business days within a given date range. And because not everyone can agree on what is a business day, the function allows the user to select which days are to be filtered out as non-business days. I have not done a function to find if a particular day in the future is a business day, but that can be added quite easily. This function can determine holidays on any given year so you don't need the typical holiday table that most people suggest using.

date function/tool to determine future business days/ holidays

Hi,

Does SQL server 2005 provide a function to determine future BUSINESS day ? What about holidays ? I sthere a way to feed a holiday file into a table and have SQL Server determin if the future date falls on a business day ?

As far as you do not mean the fixed calculated public holidays (like Easter, which can be calculated with a Gauss formula) you will have to implement that on your own having a custom table with the special dates.

Jens K. Suessmeyer


http://www.sqlserver2005.de

|||

Thanks but I am still unclear. If I'd like to know if today's date + 100 days from now would fall on a business day . Is there a ready-to-use MS SQL function that I can use or should I write it on my own ?

|||

Well, define business day. There is not a common understanding of business day (even in one countrym like here in Germany :-) )

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Hello. I think the following library of functions can help with the issue of finding Business Days:

http://www.SQLsharp.com/

I just added some date functions and one of them is finding the number of business days within a given date range. And because not everyone can agree on what is a business day, the function allows the user to select which days are to be filtered out as non-business days. I have not done a function to find if a particular day in the future is a business day, but that can be added quite easily. This function can determine holidays on any given year so you don't need the typical holiday table that most people suggest using.

Sunday, February 19, 2012

Date Conversion throws truncation error

Hi,

I am trying to process a flat file feed. My date is in format of YYYYMMDD. The database column is of datatype "datetime". I have tried using all date related data types on FLAT FILE Connection Manager. I have also tried using Data Conversion Component. No luck so far!!

Any suggestion?

Thanks in advance,
-AnandTry the Derived Column Transformation.

This post doesn't solve exactly the same problem but its very very similar: http://blogs.conchango.com/jamiethomson/archive/2005/07/26/1867.aspx

-Jamie|||

The key point is, yyyymmdd cannot be casted to date type. (This has been bugged I believe, but feel free to log again it as I know I want it!). Using the Derived Column to crack it into format that can then be casted is the only route. I did test what was suppoted and what wasn't, but seem to have lost the packages for now....

I would also check you cracked format works for US/UK locales, as the flip-flop between the two can really mess you up. I like dd mmm yyyy myself, as no languages muck that up, not even VBScript! This may help as a start if you follow that format-

(MONTH(RowDate) == 1 ? "January" : MONTH(RowDate) == 2 ? "February" : MONTH(RowDate) == 3 ? "March" : MONTH(RowDate) == 4 ? "April" : MONTH(RowDate) == 5 ? "May" : MONTH(RowDate) == 6 ? "June" : MONTH(RowDate) == 7 ? "July" : MONTH(RowDate) == 8 ? "August" : MONTH(RowDate) == 9 ? "September" : MONTH(RowDate) == 10 ? "October" : MONTH(RowDate) == 11 ? "November" : MONTH(RowDate) == 12 ? "December" : "InvalidMonth")

|||Hi,

I have partial success with "Data Conversion". What should I do for the column which may contain '' or null?

One more thing: Is dt_dbdate in SSIS compatible with datetime in SQL Server 2005?

-Anand|||Hi,

Will this work in the "Derived Column"?

ISNULL([Maturity Date]) ? : (DT_DBDATE)(SUBSTRING(TRIM([Maturity Date]),5,2) + SUBSTRING(TRIM([Maturity Date]),6,2) + SUBSTRING(TRIM([Maturity Date]),1,4))|||I have resolved the issue using following "Derived Column" statement:

(TRIM([Maturity Date]) == "") ? NULL(DT_WSTR,8) : SUBSTRING(TRIM([Maturity Date]),5,2) + "/" + SUBSTRING(TRIM([Maturity Date]),7,2) + "/" + SUBSTRING(TRIM([Maturity Date]),1,4)

Cheers,
Anand

Big Smile