![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
In the ndc column there were some imported rows from Excel with scientific notation. I am trying to find those rows using preg_match so I can located the . and then pad with zeros the number of the exponent but I get a syntax error.The correct field has 11 digits and has leading zeros. It is a char field. select preg_match(^[0-9]{11}$,ndc) from inventory select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] [0-9]$,ndc) from inventory thankx, |
#3
| |||
| |||
|
|
In the ndc column there were some imported rows from Excel with scientific notation. I am trying to find those rows using preg_match so I can located the . and then pad with zeros the number of the exponent but I get a syntax error.The correct field has 11 digits and has leading zeros. It is a char field. select preg_match(^[0-9]{11}$,ndc) from inventory select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] [0-9]$,ndc) from inventory |
#4
| |||
| |||
|
|
... but I get a syntax error. select preg_match(^[0-9]{11}$,ndc) from inventory |
#5
| |||
| |||
|
|
El 17/09/2010 1:33, jr escribió/wrote: In the ndc column there were some imported rows from Excel with scientific notation. * I am trying to find those rows using preg_match so I can located the . and then pad with zeros the number of the exponent but I get a syntax error.The correct field has 11 digits and has leading zeros. It is a char field. select preg_match(^[0-9]{11}$,ndc) from inventory select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] [0-9]$,ndc) from inventory Do you mean that using PHP functions in SQL code triggers syntax errors? Weird! |
#6
| |||
| |||
|
|
On 17 Sep, 08:25, "Álvaro G. Vicario" alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> wrote: El 17/09/2010 1:33, jr escribió/wrote: In the ndc column there were some imported rows from Excel with scientific notation. I am trying to find those rows using preg_match so I can located the . and then pad with zeros the number of the exponent but I get a syntax error.The correct field has 11 digits and has leading zeros. It is a char field. select preg_match(^[0-9]{11}$,ndc) from inventory select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] [0-9]$,ndc) from inventory Do you mean that using PHP functions in SQL code triggers syntax errors? Weird! This is Janis Rough, after all this time she still doesn't know the difference between php, mysql and javascript. |
#7
| |||
| |||
|
|
El 17/09/2010 11:39, Captain Paralytic escribió/wrote: On 17 Sep, 08:25, "Álvaro G. Vicario" alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> *wrote: El 17/09/2010 1:33, jr escribió/wrote: In the ndc column there were some imported rows from Excel with scientific notation. * *I am trying to find those rows using preg_match so I can located the . and then pad with zeros the number of the exponent but I get a syntax error.The correct field has 11 digits and has leading zeros. It is a char field. select preg_match(^[0-9]{11}$,ndc) from inventory select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] [0-9]$,ndc) from inventory Do you mean that using PHP functions in SQL code triggers syntax errors? Weird! This is Janis Rough, after all this time she still doesn't know the difference between php, mysql and javascript. ... or between strings and literals. I don't know why I even try. |
#8
| |||
| |||
|
|
On 9/16/2010 7:33 PM, jr wrote: In the ndc column there were some imported rows from Excel with scientific notation. * I am trying to find those rows using preg_match so I can located the . and then pad with zeros the number of the exponent but I get a syntax error.The correct field has 11 digits and has leading zeros. It is a char field. select preg_match(^[0-9]{11}$,ndc) from inventory select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] [0-9]$,ndc) from inventory thankx, Which is just ONE of the reasons you don't want to use a char field to store numeric data. I told you it would have unwelcome consequences. *But, as usual, you just make changes willy-nilly without understanding the consequences. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck... (AT) attglobal (DOT) net ================== |
#9
| |||
| |||
|
|
jr: ... but I get a syntax error. select preg_match(^[0-9]{11}$,ndc) from inventory That should read: ?mysql select ? ?php preg_match(^[0-9]{11}$,ndc) ? ?mysql from inventory ? Might work. Perhaps. |
#10
| |||
| |||
|
|
On Sep 17, 12:34*am, "Erick T. Barkhuis" <erick.use-... (AT) ardane (DOT) c.o.m wrote: jr: ... but I get a syntax error. select preg_match(^[0-9]{11}$,ndc) from inventory That should read: ?mysql select ? ?php preg_match(^[0-9]{11}$,ndc) ? ?mysql from inventory ? Might work. Perhaps. thanks, |
![]() |
| Thread Tools | |
| Display Modes | |
| |