|
Subject:
|
counting characters in a field
|
|
Posted By:
|
emiminja
|
Post Date:
|
8/25/2006 2:24:44 PM
|
i'm a news.
but i am trying.
within a certain field (urlref), i am trying to truncated just the everything left of the '?'.
a typical entry in this record for this field would be: ("steven@steven.com" target="_blank">http://www.foreexample.com?steven@steven.com")
i know i would have to:
get count of characters in the whole string x
find where ? character is charindex('?',URLref)
get count y after ?
subract y from x
i'm confusing myself.
|
|
Reply By:
|
mat41
|
Reply Date:
|
8/26/2006 12:35:25 AM
|
My sql is not flash but ill give it a go:
;;;i am trying to truncated just the everything left of the '?'. you want the cars before the ? or the chars after the ?
;;;get count of characters in the whole string x I dont believe you need the length of the whole string
;;;subract y from x You can append strings however do not believe you can subtract
This will give you all the characters left of the ?: SELECT LEFT(URLref,CHARINDEX('?', URLref)-1) from tblName
Wind is your friend Matt
|