Alexander Rechsteiner
2006-09-06 14:48:59 UTC
Hi everybody
I have the following Problem(s):
As search-expression, I do have a Number with 11 digits (like 12345678909)
as varchar. It can start with some 0 (like 00001234567).
Now, the attribute I need to query for is a string with 30 Digits.
Problem Nr 1:
The "Numbers" (varchar(30)) on the DB are stored like this:
12.345.67
00-123-456-7
1-2-3-4-5-6-7/L
123.456.7 BLAHBLAH
Means: Its just in the DB somehow, surrounded by dots, -es, slashes, chars
or other crap.
So on, i need to compare a number like 00001234567 with a varchar(30) on the
DB, which is maybe formated like "12.345.BLABLA.67".
Problem Nr 2:
I tried to use the Replace function for something like:
SELECT REPLACE('12.345.BLABLA.67','[^0-9]','')
go;
Or, for expamle:
SELECT REPLACE('hello world','world','sunshine')
go;
Now, the use of replace with this syntax causes an error:
" Incorrect syntax near the keyword 'REPLACE'. "
But I think the syntax is correct, and if the function wouldn't be around,
it would sound like:
"Function 'REBLASE' not found. If this is a SQLJ function, use sp_help to
check whether the object exists (sp_help may produce a large amount of
output)."
Help.
Alexander
I have the following Problem(s):
As search-expression, I do have a Number with 11 digits (like 12345678909)
as varchar. It can start with some 0 (like 00001234567).
Now, the attribute I need to query for is a string with 30 Digits.
Problem Nr 1:
The "Numbers" (varchar(30)) on the DB are stored like this:
12.345.67
00-123-456-7
1-2-3-4-5-6-7/L
123.456.7 BLAHBLAH
Means: Its just in the DB somehow, surrounded by dots, -es, slashes, chars
or other crap.
So on, i need to compare a number like 00001234567 with a varchar(30) on the
DB, which is maybe formated like "12.345.BLABLA.67".
Problem Nr 2:
I tried to use the Replace function for something like:
SELECT REPLACE('12.345.BLABLA.67','[^0-9]','')
go;
Or, for expamle:
SELECT REPLACE('hello world','world','sunshine')
go;
Now, the use of replace with this syntax causes an error:
" Incorrect syntax near the keyword 'REPLACE'. "
But I think the syntax is correct, and if the function wouldn't be around,
it would sound like:
"Function 'REBLASE' not found. If this is a SQLJ function, use sp_help to
check whether the object exists (sp_help may produce a large amount of
output)."
Help.
Alexander