SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to Select records even if there is an error?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

osmansays
Starting Member

6 Posts

Posted - 01/28/2007 :  01:02:58  Show Profile  Send osmansays an AOL message  Click to see osmansays's MSN Messenger address  Send osmansays a Yahoo! Message  Reply with Quote
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)

Singapore
17584 Posts

Posted - 01/28/2007 :  01:16:47  Show Profile  Reply with Quote

select userid,username,convert(datetime,joindate,130) 
from   usertable 
where  isdate(joindate) = 1




KH

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000