?
Solved

Update query not working correctly?

Posted on 2007-04-09
1
Medium Priority
?
211 Views
Last Modified: 2011-08-18
I want to run an update query that will update one column in a table with a value from another column in another table.  Here is the SQL query I am running:
UPDATE tblLetterPrint SET tblLetterPrint.LetterDate =("LTRDATA.LtrDate");
What I am getting is, instead of the VALUE of LtrDate from table LTRDATA, I am instead getting the text string LTRDATA. in the LetterDate field.  What I want to have instead is the column LetterDate, AFTER the query is run, will contain the date value that is stored in the column LtrDate in table LTRDATA.  I am sure there is a small change I am needing to get the above SQL query to work correctly, but I am not seeing what it is...
thank you
0
Comment
Question by:wendelina
[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
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18876285
what database?

UPDATE tblLetterPrint
  SET LetterDate = l.LtrDate
FROM tblLetterPrint  lp
JOIN LTRDATA l
  ON <join condition>

in case you have only 1 row in LTRDATA, you could use:

UPDATE tblLetterPrint SET tblLetterPrint.LetterDate =( SELECT LtrDate FROM LTRDATA);
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

719 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