Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Update With a Table Join

Author  Topic 

RussB17
Starting Member

4 Posts

Posted - 2003-12-30 : 11:47:12
Whats wrong with this t-sql statement? Will this not work?
I want to update a field in my table tblGeneralSiteInfo
based on a join to another table listing those records
to update...seems simple to me but my SP will not save
because of a syntax error.
Anyone any thoughts?
Thanks...
R

UPDATE tblGeneralSiteInfo
Join tblGeneralSiteInfo ON #TempSites.SiteCollectorCode = tblGeneralSiteInfo.SiteCollectorCode
And #TempSites.SiteNum = tblGeneralSiteInfo.SiteNum
SET SiteWCODistrict = @SiteWCODistrict

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-12-30 : 11:53:08
[code]
UPDATE tblGeneralSiteInfo
SET SiteWCODistrict = @SiteWCODistrict
FROM tblGeneralSiteInfo
Join #TempSites ON #TempSites.SiteCollectorCode = tblGeneralSiteInfo.SiteCollectorCode
And #TempSites.SiteNum = tblGeneralSiteInfo.SiteNum
[/code]
Go to Top of Page

RussB17
Starting Member

4 Posts

Posted - 2003-12-30 : 12:48:25
Thank You!! Ehorn
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-12-30 : 12:55:11
Glad that worked for you RussB17.
Go to Top of Page
   

- Advertisement -