473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

A question about an error message

Hello!

I am new to this group and I hope anyone can help me. I have an error
message which is very complicated to me. Okay this message is very
simpel, but I don`t understand how to build my SQL statement. I use
MsSQL 2000 and I am new to Microsoft SQL. I have searched the web and
read the online help, but it is strange to me. At first here is my
statement:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER VIEW dbo.view_results_7
AS
SELECT TOP 100 PERCENT dbo.view_results_7a.*, dbo.table.MCC,
dbo.table.MNC, ...dbo.table.HPRP
FROM dbo.view_results_7a INNER JOIN
dbo.table ON dbo.view_results_7a.MCC COLLATE SQL_Latin1_CP1_CI_AS =
dbo.table.MCC
WHERE dbo.view_results_7a.IMSI <>
IMSI_Blacklist.tblIMSI_Stiering_Blacklist.IMSI
ORDER BY dbo.view_results_7a.BegTime DESC

GO
SET_QUOTED IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

The part in the WHERE clause throws this error. It is the error message
number 107 and the message:
"The column prefix '%.*ls' does not match with a table name or alias
name used in the query."
What is wrong with this statement? My only experience in SQL is MySQL
and I have written this statement like a MySQL statement. So is there
anyone who can help me? Please I need your help!

Dec 19 '06 #1
7 2105
I don't think you can have dbo.table.* and probably that's what the
error says when it tried to expand dbo.view_results_7a.*
....not sure though...

Co******@gmx.de wrote:
Hello!

I am new to this group and I hope anyone can help me. I have an error
message which is very complicated to me. Okay this message is very
simpel, but I don`t understand how to build my SQL statement. I use
MsSQL 2000 and I am new to Microsoft SQL. I have searched the web and
read the online help, but it is strange to me. At first here is my
statement:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER VIEW dbo.view_results_7
AS
SELECT TOP 100 PERCENT dbo.view_results_7a.*, dbo.table.MCC,
dbo.table.MNC, ...dbo.table.HPRP
FROM dbo.view_results_7a INNER JOIN
dbo.table ON dbo.view_results_7a.MCC COLLATE SQL_Latin1_CP1_CI_AS =
dbo.table.MCC
WHERE dbo.view_results_7a.IMSI <>
IMSI_Blacklist.tblIMSI_Stiering_Blacklist.IMSI
ORDER BY dbo.view_results_7a.BegTime DESC

GO
SET_QUOTED IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

The part in the WHERE clause throws this error. It is the error message
number 107 and the message:
"The column prefix '%.*ls' does not match with a table name or alias
name used in the query."
What is wrong with this statement? My only experience in SQL is MySQL
and I have written this statement like a MySQL statement. So is there
anyone who can help me? Please I need your help!
Dec 19 '06 #2
Hi,
I modified your query a little bit:

ALTER VIEW view_results_7
AS
SELECT TOP 100 PERCENT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC
WHERE view_results_7a.IMSI <tblIMSI_Stiering_Blacklist.IMSI
ORDER BY view_results_7a.BegTime DESC

Co******@gmx.de wrote:
Hello!

I am new to this group and I hope anyone can help me. I have an error
message which is very complicated to me. Okay this message is very
simpel, but I don`t understand how to build my SQL statement. I use
MsSQL 2000 and I am new to Microsoft SQL. I have searched the web and
read the online help, but it is strange to me. At first here is my
statement:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER VIEW dbo.view_results_7
AS
SELECT TOP 100 PERCENT dbo.view_results_7a.*, dbo.table.MCC,
dbo.table.MNC, ...dbo.table.HPRP
FROM dbo.view_results_7a INNER JOIN
dbo.table ON dbo.view_results_7a.MCC COLLATE SQL_Latin1_CP1_CI_AS =
dbo.table.MCC
WHERE dbo.view_results_7a.IMSI <>
IMSI_Blacklist.tblIMSI_Stiering_Blacklist.IMSI
ORDER BY dbo.view_results_7a.BegTime DESC

GO
SET_QUOTED IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

The part in the WHERE clause throws this error. It is the error message
number 107 and the message:
"The column prefix '%.*ls' does not match with a table name or alias
name used in the query."
What is wrong with this statement? My only experience in SQL is MySQL
and I have written this statement like a MySQL statement. So is there
anyone who can help me? Please I need your help!
Dec 19 '06 #3
Hi

Thanks for your answer, but the problem still exists. There is the same
error message like before.

ot*******@yahoo.com schrieb:
>
ALTER VIEW view_results_7
AS
SELECT TOP 100 PERCENT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC
WHERE view_results_7a.IMSI <tblIMSI_Stiering_Blacklist.IMSI
ORDER BY view_results_7a.BegTime DESC

I have forgot to tell you that the table tblIMSI_Stiering_Blacklist is
from another database but on the same server, so I have to write in
this way:

ALTER VIEW view_results_7
AS
SELECT TOP 100 PERCENT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC
WHERE view_results_7a.IMSI <>
IMSI_Blacklist.dbo.tblIMSI_Stiering_Blacklist.IMSI
ORDER BY view_results_7a.BegTime DESC

The error is still the same :-(

Dec 19 '06 #4
(Co******@gmx.de) writes:
I am new to this group and I hope anyone can help me. I have an error
message which is very complicated to me. Okay this message is very
simpel, but I don`t understand how to build my SQL statement. I use
MsSQL 2000 and I am new to Microsoft SQL. I have searched the web and
read the online help, but it is strange to me. At first here is my
statement:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER VIEW dbo.view_results_7
AS
SELECT TOP 100 PERCENT dbo.view_results_7a.*, dbo.table.MCC,
dbo.table.MNC, ...dbo.table.HPRP
FROM dbo.view_results_7a INNER JOIN
dbo.table ON dbo.view_results_7a.MCC COLLATE SQL_Latin1_CP1_CI_AS =
dbo.table.MCC
WHERE dbo.view_results_7a.IMSI <>
IMSI_Blacklist.tblIMSI_Stiering_Blacklist.IMSI
ORDER BY dbo.view_results_7a.BegTime DESC
...
The part in the WHERE clause throws this error. It is the error message
number 107 and the message:
"The column prefix '%.*ls' does not match with a table name or alias
name used in the query."
What is wrong with this statement? My only experience in SQL is MySQL
and I have written this statement like a MySQL statement. So is there
anyone who can help me? Please I need your help!
Didn't you get a complete error message? That should tell you what is
wrong.

But I can see the error: IMSI_Blacklist.tblIMSI_Stiering_Blacklist comes
out of nowhere. I don't know what is supposed to be, so I can't suggest
an alternative. But I would not expect the above to work on MySQL either.

Two more things:
1) Remove TOP 100 PERCENT and ORDER BY. They don't mean anything logically,
but they can result in extra processing. In SQL 2000 it may seem that
if you run a SELECT on the view that you always get data in the order
of the ORDER BY clause, but that is mere chance, and it does not happen
that easily in SQL 2005.

2) Try to remove the COLLATE clause. Adding to the query when it is not
needed can prevent indexes from being used and hamper performance.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 19 '06 #5
Erland Sommarskog schrieb:
>
Didn't you get a complete error message? That should tell you what is
wrong.

But I can see the error: IMSI_Blacklist.tblIMSI_Stiering_Blacklist comes
out of nowhere. I don't know what is supposed to be, so I can't suggest
an alternative. But I would not expect the above to work on MySQL either.

Two more things:
1) Remove TOP 100 PERCENT and ORDER BY. They don't mean anything logically,
but they can result in extra processing. In SQL 2000 it may seem that
if you run a SELECT on the view that you always get data in the order
of the ORDER BY clause, but that is mere chance, and it does not happen
that easily in SQL 2005.

2) Try to remove the COLLATE clause. Adding to the query when it is not
needed can prevent indexes from being used and hamper performance.
Hi! Okay I wrote this:

ALTER VIEW view_results_7
AS
SELECT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC AND view_results_7a.MNC =
table.MNC
WHERE view_results_7a.IMSI <>
IMSI_Blacklist..tblIMSI_Stiering_Blacklist.IMSI
But there is still this error message:

Server: No 107, 16, state 3 procedure view_results_7
"The column prefix '%.*ls' does not match with a table name or alias
name used in the query."

Dec 19 '06 #6
(Co******@gmx.de) writes:
Hi! Okay I wrote this:

ALTER VIEW view_results_7
AS
SELECT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC AND view_results_7a.MNC =
table.MNC
WHERE view_results_7a.IMSI <>
IMSI_Blacklist..tblIMSI_Stiering_Blacklist.IMSI
But there is still this error message:

Server: No 107, 16, state 3 procedure view_results_7
"The column prefix '%.*ls' does not match with a table name or alias
name used in the query."
What ugly environment are you using that only gives the unexpanaded
error message?

In any case, that IMSI_Blacklist..tblIMSI_Stiering_Blacklist still
comes out of nowhere. You need to mention it in the FROM-JOIN clause.

Besides, you have something called "table" in the query above. Since
TABLE is a reserved keyword, I would expect that to yield a syntax error,
so I suspect that you are not even posting the query you are using.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 19 '06 #7
Hi,
As suggested by Erland, table is a reserve keyword therefore you
can't have it in your query. I thought you are using table to
reference some pseodo table in the from clause so I used that because
you did not post the actual query. You have to post the actual query
for two reasons. Reason 1: I can see if you are using the 'table'
keyword in your query. If yeas, then it is obvious that was the error.
Number 2: if you have a table name in the select clause but missing
from the from clause then it will also cause error and also if you have
more tables in the from clause but not joining them appropriately in
the join or where clasue then it will be error too. So, the best thing
is if you post the actual query exactly as is.

Co******@gmx.de wrote:
Hi

Thanks for your answer, but the problem still exists. There is the same
error message like before.

ot*******@yahoo.com schrieb:

ALTER VIEW view_results_7
AS
SELECT TOP 100 PERCENT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC
WHERE view_results_7a.IMSI <tblIMSI_Stiering_Blacklist.IMSI
ORDER BY view_results_7a.BegTime DESC


I have forgot to tell you that the table tblIMSI_Stiering_Blacklist is
from another database but on the same server, so I have to write in
this way:

ALTER VIEW view_results_7
AS
SELECT TOP 100 PERCENT view_results_7a.*, table.MCC,
table.MNC, ...table.HPRP
FROM view_results_7a INNER JOIN
table ON view_results_7a.MCC = table.MCC
WHERE view_results_7a.IMSI <>
IMSI_Blacklist.dbo.tblIMSI_Stiering_Blacklist.IMSI
ORDER BY view_results_7a.BegTime DESC

The error is still the same :-(
Dec 20 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
3
by: Zachary | last post by:
Hello, I'm relatively new at Python, and am slightly confused about how the try...except mechanism is supposed to work. I am just not sure how it would be used, as it just seems that it is...
1
by: Dirk Försterling | last post by:
Hi, sorry for reposting, but it seems my message just hit nothing but air. If I posted to the wrong list or did something else wrong with the message, please let me know. I really want to...
8
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to...
2
by: Rajshekhar | last post by:
Hi all, Where can i get the complete details about the all types of errors and warnings that a C-compiler pops up..?? any pdfs or links or books to refer....! plz help me out.. Regards,...
5
by: Patrick Dickey | last post by:
Hello, All! I'm modifying some source code that I downloaded from Planet-source-code a while back, and have a question about Try Catch statements. Basically, I'm wondering if I can do a Try with...
9
by: Gustaf | last post by:
I'm confused about structured error handling. The following piece of code is a simplification of a class library I'm working on. It works, and it does what I want, but I'm still not convinced that...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
10
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have...
4
by: Steve | last post by:
I have read a couple articles online, read my Jesse Liberty book but I am still confused as to just what the best practices are for using exceptions. I keep changing how I'm working with them and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.