gertNo1
Technical User
- Sep 30, 2007
- 42
Hey Guys, I have a large field (named Details) that contains names and other information. I am trying to parse the first and last names.
The data is:
THOMAS MICHAEL TF
The “F” in the last byte is a new field
Errors:
Conversion failed when converting the varchar value 'THOMAS MICHAEL T' to data type int.
Incorrect syntax near the keyword 'FROM'.
Code:
select
LEFT(SUBSTRING(Details, 1, 26),
CHARINDEX('', SUBSTRING(Details, 1, 26) - 1)) AS LastName
LEN(LEFT(SUBSTRING(Details, 1, 26), (CHARINDEX('F',
SUBSTRING(Details, 1, 26))) + 1) AS FirstName
FROM dbo.tblImportAppliedBankDaily
WHERE TransactionID = 'A' and RecordID = 'C1'
The data is:
THOMAS MICHAEL TF
The “F” in the last byte is a new field
Errors:
Conversion failed when converting the varchar value 'THOMAS MICHAEL T' to data type int.
Incorrect syntax near the keyword 'FROM'.