Yup, it is. But before I show you an answer to that, can you not do it in CF
with ListFirst(yourQuery.FirstName, " ") when outputting?

Here's the SQL for SQL Server:

        SELECT SUBSTRING(YourColumn, 0, CHARINDEX(' ', YourColumn, 0))
        FROM YourTable

This will return an empty string if the column doesn't have a space in it.
To get around that, try:

        SELECT
                CASE SUBSTRING(YourColumn, 0, CHARINDEX(' ', YourColumn, 0))
                        WHEN '' THEN YourColumn
                        ELSE SUBSTRING(YourColumn, 0, CHARINDEX(' ', 
YourColumn, 0))
                END YourColumn
        FROM YourTable

Although I'm not happy with that and I'm sure it could be tidied up some.

Adrian

-----Original Message-----
From: [EMAIL PROTECTED] [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 21 April 2006 23:52
To: CF-Talk
Subject: extracting with SQL


what SQL code will do a list find?

say the the FirstName column has 'Richard A.' and i only want to extract
'Richard' out of it with SQL query code.

select ??(FirstName
from customers
where id = #cookie.id#

is this doable with SQL?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238447
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to