Stripping Data

  • Hi Everyone,

    I have some data that I need to strip some data from. It is a series of numbers and letters that I need only the first 4 and last 4 Alphnumeric characters from.

    Is there a query I can use to strip the first 4 and last 4 characters from the data and place it in another field?

    Thanks in advance for your help...

    David

  • this might get you started; LEFT,RIGHT and SUBSTRING functions can be used to get parts of strings.

    note how im checking to make sure that the field is at least 8 characters...that may or may not be correct in your situation.

    SELECT LEFT(SOMEFIELD,4) + RIGHT(SOMEFIELD,4) FROM SOMETABLE WHERE SOMEFIELD IS NOT NULL AND LEN(SOMEFIELD) >=8

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply