SQL Management Studio 2008 does not like '|' Vertical Bar

Posted on 2012-08-30
Medium Priority
Last Modified: 2012-09-17
Any quick fix?

Update pxdta.f4301 set phvr01='' where phdcto|phdoco|phkcoo in (select pddcto|pddoco|pdkcoo from pxdta.f4311 where pdlnty='JP')

Question by:Tom Winslow
LVL 22

Expert Comment

ID: 38352801
put brackets ([ ]) or single quotes (') around the field names
Update pxdta.f4301 set phvr01='' where [phdcto|phdoco|phkcoo] in (select [pddcto|pddoco|pdkcoo] from pxdta.f4311 where pdlnty='JP')

Open in new window

LVL 16

Expert Comment

ID: 38353051
You're trying to use a bit-wise OR function, aren't you?
A "where" clause is normally expressed like this:

where identifier_1 operation identifier_2

where FieldName = OtherFieldName
where FieldName in (select field from table)

Your expression "phdcto|phdoco|phkco" may reduce to a value, but not an identifier.
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 2000 total points
ID: 38353551
I think you want to do this:

Update pxdta.f4301 t  
  set phvr01='' 
where exists
  (select null from pxdta.f4311 o 
   where o.pdlnty='JP'
      and o.phdcto = t.phdcto
      and o.phdoco = t.phdoco
       and o.phkcoo = t.phkcoo)

Open in new window


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

839 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