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 2000 Forums
 Transact-SQL (2000)
 How to Select records even if there is an error?

Author  Topic 

osmansays
Starting Member

6 Posts

Posted - 2007-01-28 : 01:02:58
Hi
I have a problem when I try to retrive my data with simple select statment because I am using a convert method with it .My query looks like this :
select userid,username,convert(datetime,joindate,130) from usertable
as you can see I am using "convert" to change from Grigorian data to Hijri date (Arabic date).The convert method raises an error with some values and the select statment will be aborted.

I wonder if there is a way for the select statment to retrive the rest of the data which does't have error on it .just like the try..cath statment ,I need the query to stay working even if there is an error on data by just ignoring the records with error .

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-28 : 01:16:47
[code]
select userid,username,convert(datetime,joindate,130)
from usertable
where isdate(joindate) = 1
[/code]



KH

Go to Top of Page
   

- Advertisement -