March 19, 2009 at 2:42 pm
If I want to search records starting with '01', this is a possible statement:
SELECT *
FROM TableName
WHERE (LEFT(FieldName, 2) = '01')
What is the statement to retrive records that have '12009' starting in the character 14 ?
March 19, 2009 at 2:52 pm
Look up SUBSTRING in Books Online. Lookup CHARINDEX as well.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 19, 2009 at 3:40 pm
Thank you Gila!
This is the correct statement:
SELECT *
FROM TableName
WHERE (SUBSTRING(FieldName, 14, 5) = '12009')
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply