SQLTeam.com | Weblogs | Forums

String search


#1

under reference field I have the following
ST0001 TERM 1 & 2 TUITION or for example 1ST&2ND SEM TUITION:CARE DON

How can I replace the field with reference1 to include only records that have ST0001?
ST0001 Is a student number but it can be any number following ST....


#2

A table def would help. What have you tried?

However, does reference always start with ST for only students? never starts with ST if not a student?


#3

tried first to look for ST - LIKE ST%
THEN
LEFT(Reference,6)

it seem to work

I have another issue.

in my view i have YEAR,MONTH,JOURNAL. I need to add another column to my view that does not exist in the talbe.
The column would be SOURCE. All records under source should be AP. Is this possible?


#4

Reference like 'ST[0-9][0-9][0-9][0-9]%' would look for all items that start with 'ST' followed by four digits and then anything trailing afterwards. Hopefully this would limit false positives.