Solved

SQL Query Resulting in "Malformed String"

Posted on 2014-09-09
8
136 Views
Last Modified: 2015-05-10
Running a simple query and getting "Malformed string" (Query is not actually being run with MS SQL server; I'm actually using Firebird 2.5, dialect 1... but didn't see that in the list.)

I tried to run this query in Database Workbench 4.4.5 Pro:
Select P.PERSONFIRSTNAME || " " || P.PERSONLASTNAME as FullName
from Person P

Open in new window

I've used queries like this thousands of times without issue. I know the fields are good; if I take out " " then this code works fine:
Select P.PERSONFIRSTNAME || P.PERSONLASTNAME as FullName
from Person P

Open in new window

I've regularly added spaces or various punctuation in this way in many other contexts without issue. Any clue why this would suddenly start acting up?
0
Comment
Question by:EricTaylor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40313492
have you tried just single quotes?

Select P.PERSONFIRSTNAME || ' ' || P.PERSONLASTNAME as FullName
from Person P
0
 

Author Comment

by:EricTaylor
ID: 40313568
Yes... meant to mention that in my original post. Single vs. double-quotes makes no difference (at least in dialect 1). And, as I said, I've used this construction in many places elsewhere without issue.
0
 
LVL 49

Expert Comment

by:Vitor Montalvão
ID: 40313844
Maybe is the alias?
Just try without alias
Select P.PERSONFIRSTNAME || ' ' || P.PERSONLASTNAME 
 from Person P 

Open in new window

or put the concatenation in brackets '()'
Select (P.PERSONFIRSTNAME || ' ' || P.PERSONLASTNAME) as FullName
 from Person P

Open in new window

0
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
LVL 19

Expert Comment

by:NickUpson
ID: 40313973
There is an interbase/firebird area

Select P.PERSONFIRSTNAME || " " || P.PERSONLASTNAME as FullName from Person P

I would start by using firebird's own isql tool to run the same query and see if you get the same result, can you narrow down the data row(s) that produce the error. Also use the single quotes just to eliminate that and your connection dialect (dbworkbench may default to 3)
0
 

Author Comment

by:EricTaylor
ID: 40318306
DBWorkbench is clearly set to Dialect 1 for this db. Single quotes makes no difference. And the query runs correctly in IBOConsole and in my applications' calls to the server... so it seems to be a DBWorkbench issue. So, I guess the query was okay... so no real question remains.
0
 

Accepted Solution

by:
EricTaylor earned 0 total points
ID: 40429341
Issue turned out to be a characterset issue in DBWorkbench; dataset somehow got set to an incorrect character set. Nothing was wrong with the query syntax.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question