I have written a line to a field that I need to separate out now using sql. The value would be something like "ID:100004 23ksdflk". I need to pull just the 100004 value for part of my query. Any ideas?
I have written a line to a field that I need to separate out now using sql. The value would be something like "ID:100004 23ksdflk". I need to pull just the 100004 value for part of my query. Any ideas?
Chris Martz
United Art & Education
What's wrong with SUBSTRING?
SELECT SUBSTRING(fieldname,4,6) FROM tablename
http://www.esedirect.co.uk
--------------------------------------------------------------------------
Using MS 9.2.0.0 with the following customisations:
Lightbox/Fancybox enlarged images;
Auto-suggest searchbox;
Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
Failed transactions emailed via trigger;
Custom app to show basket contents when customer online;
Orders pushed through to accounting systems.
All the above without source!
There are a few 'string.split' sprocs published here:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648
Webopius.com: ASPDotNetStorefront web development and ecommerce project management
Webopius is now a Sage Pay Approved Partner
I ended up using the following:
This finds "ID:" and takes the 6 numbers to the right of it.Code:LEFT(SUBSTRING(col, nullif(PATINDEX('%ID:[^ ]% %', col),0)+3, LEN(col)),6) AS ORDER_NUM,
Chris Martz
United Art & Education