Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tleonard
Starting Member
13 Posts |
Posted - 2008-10-06 : 16:50:33
|
| set @startposition = charindex('&CVV2MATCH', @bin) + 11I received an error on the statement above. I assume because &CVV2MATCH character set did not exist in the string. Therefor, I need to know how to test to see if the character exist prior to executing the statement.Below is the entire character set when the error occured.@bin = 'RESULT=23&PNREF=VSHF2DF84B32&RESPMSG=Invalid account number: INVALID CARD&AVSADDR=X&AVSZIP=X'tl |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-06 : 16:52:47
|
If '@CVV2MATCH' does not exists in the string, CHARINDEX returns 0. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-06 : 16:53:49
|
set @startposition = NULLIF(charindex('&CVV2MATCH', @bin), 0) + 11Now @startposition is NULL if '&CVV2MATCH' doesn't exists. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-06 : 23:50:12
|
| try this:-set @startposition = patindex('&CVV2MATCH%', @bin) + 11 |
 |
|
|
tleonard
Starting Member
13 Posts |
Posted - 2008-10-07 : 15:02:59
|
| This is what I needed. Thanks for both the response's. |
 |
|
|
|
|
|