Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 time validation

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2007-04-01 : 02:49:55
Hi guys can anybody solve the issue given below:

Create procedure bt_time char(10)
as
--Validation is:
1) if the user enters character in the bt_time variable system should throw error
2) bt_time should contain only time between 1-24.the user can enter only the range between 1-24,1.30,8.00









khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-01 : 03:25:59
use isdate()


KH

Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-04-03 : 01:32:21
I'm thinking that ISDATE() just isn't going to work with just the number of decimal hours being provided.

If you are doing these entries from a gui, the data should be validated there, perhaps by using an Input Mask.

--Jeff Moden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-03 : 03:10:57
quote:
Originally posted by Jeff Moden

I'm thinking that ISDATE() just isn't going to work with just the number of decimal hours being provided.

If you are doing these entries from a gui, the data should be validated there, perhaps by using an Input Mask.

--Jeff Moden


I agree with you
Like ISNUMERIC, ISDATE also should be handled with care

SELECT ISDATE(3000),ISDATE('2000'),ISDATE(2000),ISDATE('MARCH 06'),ISDATE('MARCH 2006'),ISDATE('MAR 2006')

It seems that user wants to validate date before sending data to table. If that is the case it should be validated at front end



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -