We help IT Professionals succeed at work.

Q about date validation in a BRIO SQR program

iainmac
iainmac asked
on
843 Views
Last Modified: 2007-12-19
I asked this Q in the DB Reporting TA but I'm not getting any takers so I thought I'd give it a shot here.

I have written a program which reads an input text file (tab delimited fields), validates the data and inserts some records into a MSSQL 2000 database.

One of the fields is a date, meant to be in the format DD/MM/YYYY.

Under declare-variable I have described $mydate as a date field.

I use the command ...... let $mydate = strtodate(&inputdate,'DD/MM/YYYY') .... and it works just fine.

But when I put an invalid date (eg 30/02/2004) into my test data, the BRIO program crashes.

Which is fair enough I guess. So I need to validate the date before I put it thru the strtodate command.

Which brings us to my question. I don't want to reinvent the wheel and write a comprehensive date validation routine in a language I'm struggling with. Does BRIO offer a tool or command I can use? Or do any of you guys have some BRIO code that would be helpful?

Thanks for any advice.
Comment
Watch Question

Hi iainmac,

the IsDate() functions do this...

btw, you are using Microsoft SQl server, right?

Esteban Felipe
www.estebanf.com

Author

Commented:
Hi Esteban,

I'm using a BRIO SQR program to read a flat file (text file) of records and then insert records into various tables in a Microsoft SQL 2000 database.

I can't see an IsDate() function in BRIO. Do you mean it is in BRIO, or is it an MSSQL thing? What I need is a BRIO solution.

This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2011
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Lowfatspread,

Thanks for your input.

Yeah, I have stumbled upon and used the SQL error checking but the instruction that crashes my program is not SQL. It is "strtodate", which lets you convert a string containing a date into a date field.

It's beginning to sound as though I will need to develop my own SQR date validation routine. Quel drag.

CERTIFIED EXPERT
Top Expert 2011

Commented:
then i'd suggest again

insert into a staging table in sql server
and then use the sqr - sql interface
and use isdate/isnumeric sqk server funbction etc on the  select to achieve what you require....


Author

Commented:
Thanks guys,

I will try the staging table approach.

Iain

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.