Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
543 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
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 UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

972 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