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
519 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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now