Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Determine if query result begins with a number

Participant ,
Sep 10, 2008 Sep 10, 2008
I have query results like this

123PKM
AAPL
WB
9865W
CF
QRST

How can I determine if the query result begins with a number?
Like 123PKM and 9865W do begin with a number.

But the others dont.
533
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 10, 2008 Sep 10, 2008
The refind() would do that task very easily. Not tested, but I think
this would be the idea.

<cfoutput>#refind('^[0-9]',myQuery.aField,1,false)#</cfoutput>

The ColdFusin documentation all over the place will fully define the
capabilities of the refind() function. It will even provide some basics
of the regular expression syntax used by this function.
Translate
LEGEND ,
Sep 10, 2008 Sep 10, 2008
The refind() would do that task very easily. Not tested, but I think
this would be the idea.

<cfoutput>#refind('^[0-9]',myQuery.aField,1,false)#</cfoutput>

The ColdFusin documentation all over the place will fully define the
capabilities of the refind() function. It will even provide some basics
of the regular expression syntax used by this function.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 10, 2008 Sep 10, 2008
LATEST
weezerboy wrote:
> How can I determine if the query result begins with a number?

Another option is to determine that inside your sql query using string functions. For MS SQL you could use patindex()

SELECT PATINDEX('[0-9]%', someColumn) AS StartsWithNumber,
otherColumns ...
FROM someTable

In your query results the StartsWithNumber column would contain either: 1 (true) or 0 (false).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources