Solved

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

Posted on 2004-09-06
5
525 Views
Last Modified: 2008-01-09
hello,

i get this error msg in QA [SQL2000 sp3a]

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

what does this mean??? i am not sure

this is the query i am trying to run...


SELECT     MSM_SVCCALLTABLE.PROJID AS Expr1, MSM_SVCCALLTABLE.CALLLEVEL AS Expr2, PROJTABLE.PROJID, PROJTABLE.STATUS
FROM         PROJTABLE INNER JOIN
                      MSM_SVCCALLTABLE ON PROJTABLE.PROJID = MSM_SVCCALLTABLE.PROJID
update projtable
set status = '4'
WHERE     (MSM_SVCCALLTABLE.CALLLEVEL = 7)



tables = msm_svccalltable, projtable
fields = msm_svccalltable - projid, calllevel
           projtable.projid, status

any ideas ????

thanks!
0
Comment
Question by:acetate
  • 3
  • 2
5 Comments
 

Author Comment

by:acetate
ID: 11993125
sorry, to make this a bit clearer, how do i modify my script to work?? this is my end goal, and also to understand what i did wrong also.

thanks

0
 
LVL 15

Expert Comment

by:jdlambert1
ID: 11993151
QA sees your code as first a SELECT statement, then an UPDATE statement, and tries to execute one after the other. The error is generated by the UPDATE statement, because it refers to the MSM_SVCCALLTABLE table without including it in a FROM clause. You didn't describe what you want your UPDATE to do, but I'm guessing this is your intention:

UPDATE projtable SET status = '4'
FROM PROJTABLE INNER JOIN MSM_SVCCALLTABLE ON PROJTABLE.PROJID = MSM_SVCCALLTABLE.PROJID
WHERE MSM_SVCCALLTABLE.CALLLEVEL = 7
0
 
LVL 15

Accepted Solution

by:
jdlambert1 earned 500 total points
ID: 11993162
BTW, if you're not familiar with it, one of QA's zillion excellent features is that you can select (highlight) any portion of code in the main window and tell it to execute (F5 or the green arrow button) and it will execute only that portion of code that's selected. It's a huge time-saver in troubleshooting T-SQL.
0
 
LVL 15

Expert Comment

by:jdlambert1
ID: 11993169
Another BTW, you can use aliases on table names, to avoid having to retype the whole name over and over. For example, the query I posted above can be modified to:

UPDATE p SET status = '4'
FROM PROJTABLE p
 INNER JOIN MSM_SVCCALLTABLE m ON p.PROJID = m.PROJID
WHERE m.CALLLEVEL = 7
0
 

Author Comment

by:acetate
ID: 11993175
champion!

thansk for the explanation + the script!

AAAA1!

cheers and beers from australia!


0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

828 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