In order to define multiple variables, you must use "a list syntax that is enclosed in square brackets [ ] and is separated by semicolons". In your example, that means =
Let ( [
SQL_Msg_Raw = Trim (Substitute (ODBCError ; "[Microsoft][SQL Server Native Client 10.0][SQL Server]"; "" )) ;
Diagnostic_Key_Pos = Position ( SQL_Msg_Raw ; "~SE" ; 1 ; 1 ) + 3
Thanks, Michael. I forgot all about "[", and couldn't see it when I read the documentation . . .