Share via

SQL Select Failed Syntax Error 3706: expected something between '(' and the string 'i'. What am I missing?

Anonymous
2019-09-19T13:47:26+00:00

It seems to want something between the CHARINDEX ( and the 'i'   I've tried several things but I'm not getting the query to run.  Any suggestions?

 FROM
  (SELECT DISTINCT knum, CASE WHEN CHARINDEX('i', knum, 1) = 0 THEN knum ELSE SUBSTRING(knum, 1, CHARINDEX('i', knum, 1)-1) END AS confirmation_nbr
  FROM translog
  WHERE ((Bgn01 = '581' AND msg LIKE '%Status%C%') OR
  (Bgn01 = '628' AND DATALENGTH(knum) > 0))
  AND CONVERT(date, trans_date, 101) = :dbrDate
  )
Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2019-09-19T18:57:48+00:00

    The colon is more typical in Oracle https://www.quora.com/What-is-bind-variable-in-PL-SQL. I expect this is similar to @dbrDate in SQL server syntax that I am more used to.

    I attempted to determine if the colon is viable in MS SQL Server but couldn't quickly find something either way.

    I expect this question should be posted in a more appropriate forum.

    Was this answer helpful?

    0 comments No comments