0
SUBSTRING('Electronic Payment Successful.;  -- Transaction Id <P291118333151428004>; Card <1272>;  Amt <$118.00>; Date <11/29/2018 3:14:27 PM>; Vendor Name <TSYS>; Status Code<1> ;Status Description <Transaction Approved>; Response Code<00> ;Response Description <Approved>; Approval Code <121041>; Processor TransId <4401919651>;',53,19)

Gives me the following error:

Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '%Electronic Payment Successful.; -- Transaction Id ; Card <1272>; Amt ; Date <11/29/2018

Dale K
  • 25,246
  • 15
  • 42
  • 71
  • Giving me error Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '%Electronic Payment Successful.; -- Transaction Id ; Card <1272>; Amt <$118.00>; Date <11/29/2018 3:14:27 '. – Tarun.bhalla Nov 30 '18 at 01:52
  • I get `P291118333151428004` – Dale K Nov 30 '18 at 01:55
  • i am getting error message – Tarun.bhalla Nov 30 '18 at 01:55
  • 1
    In that case it seems you are doing something other than the code you've posted - because that code works. – Dale K Nov 30 '18 at 01:57
  • 1
    There is something else going on in your code. Perhaps you forgot to close the quotes, or there is a single quote embedded in the string? – John Wu Nov 30 '18 at 01:57
  • For a discussion on how to escape special chars in SQL Server, see https://stackoverflow.com/questions/258757/escape-a-string-in-sql-server-so-that-it-is-safe-to-use-in-like-expression – GMB Nov 30 '18 at 02:11
  • Code works as is. Is it part of a string to use for a prepared statement? – rpd Nov 30 '18 at 08:08

0 Answers0