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
 General SQL Server Forums
 New to SQL Server Programming
 Colum prefix error

Author  Topic 

tdbell
Starting Member

2 Posts

Posted - 2008-11-29 : 04:22:17
hello

Been trying to figure this out for a few days now, and I am absolutely stumped on what I am doing wrong.

the query is as such:

UPDATE phd_final set phd_final.db_bestnr =

phd_new.db_bestnr, phd_final.db_stregkode =
phd_new.db_stregkode, phd_final.db_titelnavn =
phd_new.db_titelnavn, phd_final.db_titelnavn2 =
phd_new.db_titelnavn2, phd_final.db_type =phd_new.db_type,
phd_final.db_nav1 = phd_new.db_nav1, phd_final.db_nav2 =
phd_new.db_nav2, phd_final.db_nav_3 = phd_new.db.nav_3,
phd_final.db_pris = phd_new.db_pris, phd_final.Col010 =
phd_new.Col010
WHERE phd_new.db_bestnr = phd_final.db_bestnr AND
phd_final.db_pris != phd_new.db_pris

However when I execute it, I get the following error.

Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'phd_new' 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 'phd_new' 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 'phd_new' 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 'phd_new' 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 'phd_new' 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 'phd_new' 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 'phd_new' 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 'phd_new.db' 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 'phd_new' 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 'phd_new' 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 'phd_new' 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 'phd_new' does not match with a table name or alias name used in the query.

Im using MSSQL and the table exists, and i've chosen the correct database - I just cant figure what is going on. I realize its a problem with the prefix, but the table does exist, so I dont know what to do.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-29 : 04:27:12
UPDATE pf
set pf.db_bestnr =
pn.db_bestnr, pf.db_stregkode =
pn.db_stregkode, pf.db_titelnavn =
pn.db_titelnavn, pf.db_titelnavn2 =
pn.db_titelnavn2, pf.db_type =pn.db_type,
pf.db_nav1 = pn.db_nav1, pf.db_nav2 =
pn.db_nav2, pf.db_nav_3 = pn.db.nav_3,
pf.db_pris = pn.db_pris, pf.Col010 =
pn.Col010
from phd_final as pf inner join phd_new as pn
on pn.db_bestnr = pf.db_bestnr
WHERE pf.db_pris != pn.db_pris

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

tdbell
Starting Member

2 Posts

Posted - 2008-11-29 : 05:00:17
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'pn.db' does not match with a table name or alias name used in the query.

Still makes no difference :/ thanks for the answer though
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-29 : 05:15:26
quote:
Originally posted by tdbell

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

Still makes no difference :/ thanks for the answer though

Did you execute exactly the code I posted?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-29 : 08:18:44
quote:
Originally posted by tdbell

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

Still makes no difference :/ thanks for the answer though


seems like you missed _ in Madhi's post. Can you copy paste code provided and try executing it?
Go to Top of Page

shijobaby
Starting Member

44 Posts

Posted - 2009-08-20 : 03:00:15
the column prefix does not match with a table name or alias name used in the query.

I was also working to solve this error

Nw i found why it is comming just needs to make small changes in query

http://sqlerrormessages.blogspot.com/2009/08/sql-server-error-messages-msg-107.html
Go to Top of Page
   

- Advertisement -