Conversion Error From String 0
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have conversion error from string firebird date Meta Discuss the workings and policies of this site About Us Learn
Firebird Date Format
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up conversion error from string, when using params in SQL up vote 1 down vote favorite using Delphi 2010 (Firebird [testing], MS Sql Server, Oracle [production]) The following is my SQL SELECT p.script_no, MIN(p.start_Time) as startTime, MAX(p.end_Time) as endTime, SUM(p.duration) as TotalDuration FROM phase_times p WHERE (p.script_no=:scriptNo) AND (Trunc(p.start_time) >= :beginDateRange) AND (Trunc(p.start_time) <= :endDateRange) GROUP BY p.script_no ParamByName('beginDateRange').AsDate:= Date - 30; ParamByName('endDateRange').AsDate:= Date; I am getting a "conversion error from string - 10-25-2012" and i am not sure why, since my datetime fields are in the "10/25/2012 9:20:49 AM" format in the database. If i change it to the following : ParamByName('beginDateRange').AsString := formatDateTime('mm/dd/yyyy',Date - 30).....i get the error "conversion error from string - 10/25/2012" reserching this error has provided me no new avenues, do you have any ideas? delphi delphi-2010 firebird share|improve this question edited Oct 25 '12 at 14:46 ain 16.4k22854 asked Oct 25 '12 at 14:38 Blow ThemUp 3901925 3 What is the data type of the start_Time field? (VAR)CHAR or TIMESTAMP? –ain Oct 25 '12 at 14:45 both begin and end date fields are datetime –Blow ThemUp Oct 28 '12 at 23:25 @Jake - Firebird does not have a datetime data type. –Sertac Akyuz Oct 29 '12 at 15:44 add a comme
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to http://stackoverflow.com/questions/13071007/conversion-error-from-string-when-using-params-in-sql handle date conversion error in SQL? up vote 8 down vote favorite So I'm trying to convert strings in an SQL databse into datetime values. I have some dates in a table like this: 23/12/2013 16:34:32 24/12/2013 07:53:44 24/12/2013 09:59:57 24/12/2013 12:57:14 24/12/2013 12:48:49 24/12/2013 13:04:17 24/12/2013 13:15:47 24/12/2013 13:21:02 24/12/2013 14:01:28 24/12/2013 14:02:22 24/12/2013 14:02:51 They are stored as strings unfortunately And I http://stackoverflow.com/questions/21422029/how-to-handle-date-conversion-error-in-sql want to convert them to datetime SELECT CONVERT(datetime, analysed, 103 ) FROM OIL_SAMPLE_UPLOAD However I get this message when I run the query The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. Presumably because some values are badly formed (although I am yet to spot any of these) It's ok if some values don't convert, I just need a way of handling this situation. Something like ISNULL(CONVERT(datetime, analysed, 103 )) would be good except that the convert function does not return NULL when it fails. sql string tsql error-handling type-conversion share|improve this question asked Jan 29 '14 at 4:20 sav 7691922 to be clear the strings are in dd/MM/yyyy hh:mm:ss format –sav Jan 29 '14 at 4:31 add a comment| 3 Answers 3 active oldest votes up vote 10 down vote accepted For SQL Server you can use ISDATE() function to check whether value is valid date SELECT CASE WHEN ISDATE(analysed)=1 THEN CONVERT(datetime, analysed, 103 ) ELSE '' END FROM OIL_SAMPLE_UPLOAD share|improve this answer answered Jan 29 '14 at 4:25 mhasan 14.6k54384 1 I'd prefer not to make any change
funcionarão. Por favor, habilite o javascript para ter acesso à todas as funcionalidades. Publicidade Últimos Tópicos Últimos Tópicos Resolvidos Tópicos melhor avaliados Tópicos Quentes Estatísticas do Fórum 1 Usuários ativos http://forum.imasters.com.br/topic/472658-resolvido%C2%A0erro-conversion-error-from-string-0/ 0 membros, 1 visitantes, 0 membros anônimos Siga o iMasters Siga o iMasters no Twitter Siga o iMasters no Linkedin Siga o iMasters no Facebook Siga o Feed iMasters Siga o iMasters no Github [Resolvido]Erro Conversion Error From String "0" Criado por #Allan , Ago 16 2012 11:05 Por favor, faça o login para responder 6 respostas neste tópico conversion error #1 #Allan #Allan Members 11 posts Postado 16 agosto 2012 - 11:05 Bom dia, estou tentando fazer um relatório que filtra entre duas datas e esta dando o seguinte erro: conversion error from string "0" segue abaixo as linha de comando! MaskEdit1.Text:= DatetoStr(DateTimePicker1.Date); MaskEdit2.Text:= DatetoStr(DateTimePicker2.Date); formRelPagarData.qrPagar.Close; formRelPagarData.qrPagar.SQL.clear; formRelPagarData.qrPagar.SQL.add('SELECT * FROM PAGAR WHERE DATVC BETWEEN '+MaskEdit1.text+' AND '+MaskEdit2.text); formRelPagarData.qrPagar.Open; obrigado desde conversion error from já Allan 0 Voltar para o topo Publicidade #2 FK. FK. fodase Banned 627 posts Postado 16 agosto 2012 - 11:47 1 Editado por FK., 29 agosto 2016 - 22:08 . 1 Voltar para o topo #3 #Allan #Allan Members 11 posts Postado 16 agosto 2012 - 14:15 FK muito obrigado pela sua ajuda, deu certo usando o ParamByName. foi meu primeiro post no iMasters, me desculpe pelo meu erro! 1 Voltar para o topo #4 FK. FK. fodase Banned 627 posts Postado 16 agosto 2012 - 14:46 3 0 Voltar para o topo #5 #Allan #Allan Members 11 posts Postado 16 agosto 2012 - 16:39 Só mais uma dúvida, nessa linha de comando q eu postei estou filtrando somente entre datas, que seria o total das contas que o cliente tem q pagar nesse período. Eu preciso também fazer um relatório que filtre o Fornecedor e tambem as datas! É so eu colocar mais um AND adicionar FORNE? 0 Voltar para o topo #6 FK. FK. fodase Banned 627 posts Postado 16 agosto 2012 - 16:52 4 1 V