Solved

Update table value with join syntax

Posted on 2016-09-01
2
46 Views
Last Modified: 2016-09-01
I have two tables that have a common field (to join)

Table 1:  Forms
Field 1: FormName (varchar 40)
Field 2: FormDesc (varchar 255)

Table 2: FormsCatalog
Field1: FormName (varchar 40)
Field 2: FormDesc (varchar 255)

I want to join both tables b the FormName, which is the same in both. And update the table 2 field 2 with the value of table 1 field 2

Something like

Update Formscatalog a
set a. FormDesc = b.FormDesc
where a.Formname JOINED TO b.FormName
and Forms as b

Open in new window


Obviously the syntax is incorrect, this is what I need help with. Simply join the tables by the name and have formscatalog.description be the same as forms.description

Hope I explained myself well.
0
Comment
Question by:amucinobluedot
2 Comments
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
ID: 41780864
In T-SQL, I think something like this may be what you want:
Update a
set a.FormDesc = b.FormDesc
FROM Formscatalog a
INNER JOIN Forms b on b.FormName = a.FormName

Open in new window

0
 

Author Closing Comment

by:amucinobluedot
ID: 41780871
Thx!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
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
Viewers will learn how the fundamental information of how to create a table.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now