Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 1st, 2007, 03:52 PM
Registered User
Join Date: Sep 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default String manipulation

I have a column of data that has values such as this (with spaces within):

a1 234
ab12 ddd
a11 12d
s4 9dd

I want to be able to re-select this column of data and split it so that the first part of the data (before the space) is separate from the second part of the data (after the space). So "A1 234" would be "A1" Column1 and "234" Column2, "Ab12 ddd" would be "Ab12" Column1 and "ddd" Column2 etc....

I'm thinking along the lines of using the Left and Substring functions but not sure how best to implement them.


Old October 1st, 2007, 04:24 PM
Registered User
Join Date: Sep 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

ahhh - just worked out my own soln along the lines of:

select left(columnname,charindex(space(1), columnname))
from mytable


Similar Threads
Thread Thread Starter Forum Replies Last Post
String manipulation Franco1 Visual Basic 2005 Basics 1 July 16th, 2008 12:53 PM
String manipulation pcase XSLT 5 June 14th, 2007 10:32 AM
String manipulation YoungLuke C# 4 May 4th, 2007 01:46 AM
String Manipulation twsinc Access 3 February 23rd, 2004 09:57 AM
String Manipulation Ben Access VBA 2 July 8th, 2003 05:53 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.