Solved

SQL Query Resulting in "Malformed String"

Posted on 2014-09-09
8
122 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
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 48

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

860 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