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)
 Help (Correction)

Author  Topic 

pharoah35
Yak Posting Veteran

81 Posts

Posted - 2003-09-09 : 08:58:18
Good morning good people.

I am having a bit of a problem with the following T-SQL Syntax.
I was hoping that one of you kind Ladies or Gentlemen could lend some assistance.

I am referencing 2 tables listed below via the Select statement
dbo.tblproitem & dbo.tblingrampb,

I need to update the [Brand] column in table dbo.tblingrampb with 'COMPAQ' where the value in column [vendid] in table dbo.tblproitem is the same as the value in [vend id] in table dbo.tblingrampb and the [progid] in table dbo.tblproitem = 21099

Here is the syntax I used.

----------------------------------------------------------------------
SELECT * from dbo.tblproitem, dbo.tblingrampb

update dbo.tblingrampb
set dbo.tblingrampb.[Brand] = 'COMPAQ'

Where dbo.tblproitem.[vendid] = dbo.tblingrampb.[vend id] and dbo.tblproitem.[ProgID] = '21099'
----------------------------------------------------------------------
I get the following error message via QA (Query Analyzer)

----------------------------------------------------------------------
Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'dbo.tblproitem' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 1
The column prefix 'dbo.tblproitem' does not match with a table name or alias name used in the query.
----------------------------------------------------------------------

I would appreciate any assistance you may be able to provide
Thanks in advance
Pharoah35

mr_mist
Grunnio

1870 Posts

Posted - 2003-09-09 : 09:36:14
You're almost there...


update dbo.tblingrampb
set dbo.tblingrampb.[Brand] = 'COMPAQ'
FROM dbo.tblingrampb
INNER JOIN
dbo.tblproitem
ON
dbo.tblproitem.[vendid] = dbo.tblingrampb.[vend id]
Where dbo.tblproitem.[ProgID] = '21099'



-------
Moo. :)
Go to Top of Page

pharoah35
Yak Posting Veteran

81 Posts

Posted - 2003-09-09 : 10:51:27
Dear Mr Mist

Thank you so very much for your assistance.
That really did the trick.

Thanks again
Pharoah35
Go to Top of Page
   

- Advertisement -