Error Invalid Column Name (In Sqlserver 2005) While Giving Alias Column Name

Jan 15, 2008

ALTER procedure [dbo].[MyPro](@StartRowIndex int,@MaximumRows int)

As

Begin

Declare @Sel Nvarchar(2000)set @Sel=N'Select *,Row_number() over(order by myId) as ROWNUM from MyFirstTable Where ROWNUM

Between ' + convert(nvarchar(15),@StartRowIndex) + ' and ('+ convert(nvarchar(15),@StartRowIndex) + '+' + convert(nvarchar(15),@MaximumRows) + ')-1'

print @Sel

Exec Sp_executesql @Sel

End

 

--Execute Mypro 1,4        --->>Here I Executed

 Error

Select *,Row_number() over(order by myId) as ROWNUM from MyFirstTable Where ROWNUM

Between 1 and (1+4)-1

Msg 207, Level 16, State 1, Line 1

Invalid column name 'ROWNUM'.

Msg 207, Level 16, State 1, Line 1

Invalid column name 'ROWNUM

Procedure successfully created but giving error while Excuting'.

Please anybody give reply

Thanks

 

View 2 Replies


ADVERTISEMENT

Select Alias -- Invalid Column Name

Jun 26, 2007

Hi,I got 'Invalid Column Name NewCol1' when I query the following:Select col1, col2, (some calculation from the fields) as NewCol1,(some calculation from the fields) as NewCol2,NewCol1 = NewCol2 fromTable1 inner join Table2 inner join Table3....Where.....Basically, I want to find out if NewCol1 = NewCol2 after thecalculationAny advice?Thanks in advance. Your help would be greatly appreciated.Wanda

View 5 Replies View Related

Invalid Column Name 'rowguid'. Error When Generating Snapshot For Merge Replication SQL Server 2005

May 15, 2007

Hi there,



I have setup merge replication which successfully synchronizes with a group of desktop users using SQL Compact Edition.



However now I have setup Article Filters and when I attempt to regenerate the snapshot I get the following error:



Invalid column name 'rowguid'.

Failed to generate merge replication stored procedures for article 'AssignedCriteria'.



When I look at publication properties at the Articles page.. All my tables have the rowguid uniqueidentifier successfully added to tables and selected as a compulsory published column, apart from the table above "AssignedCriteria".. Even when I attempt to select this column in the article properties page and press ok, when I come back it is deselected again. ( The Rowguid column is however physically added to the table)



I have scripted the publication SQL and then totally reinstalled from scratch, including the database but for some reason it doesn't like this table. I remove the article filters, but still this "rowguid" is never "selected" in article properties.



We are using Uniqueidentifiers in other columns as well for historical reasons, but this doesn't appear to be a problem in other tables..



DDL For this problematic table is as follows



CREATE TABLE [dbo].[AssignedCriteria](

[AssignedCriteria] [uniqueidentifier] NOT NULL,

[CriteriaName] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

[TargetScore] [numeric](5, 0) NULL,

[HRPlan] [uniqueidentifier] NULL,

[ActualScore] [numeric](18, 0) NULL,

[Criteria] [uniqueidentifier] NULL,

[Employee] [uniqueidentifier] NULL,

[IsActive] [bit] NULL,

[addDate] [datetime] NULL,

[totalscore] [numeric](5, 0) NULL,

[isCalc] [bit] NULL,

[Weight] [decimal](18, 2) NULL,

[ProfileDetail] [uniqueidentifier] NULL,

[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [MSmerge_df_rowguid_7FF25DF903B6415FBFF24AC954BC88E4] DEFAULT (newsequentialid()),

CONSTRAINT [PK_AssignedCriteria] PRIMARY KEY CLUSTERED

(

[AssignedCriteria] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



Thanks.



View 5 Replies View Related

Error In Using Alias Column Name As Function Parameter

May 16, 2012

I am working on migrating view from Ms Access to SQL server. I got a query and modified it by removing IIF by CASE WHEN. I landed into following query:

Code:
SELECT CASE WHEN <CONDITION>
THEN DATEADD(YYYY,YR1,DATEADD(D,DAY1,TXNDATE))
ELSE 0
END AS CurrentDateAdj,
Year(CurrentDateAdj) + '_' + 'some text and processing')
FROM INCREMENTDATATABLE;

Here DAY1 and YR1 are from INCREMENTDATATABLE.

I am getting error that CurrentDateAdj not found. How can I fix this?

View 4 Replies View Related

SQL Server 2008 :: Display A Column Alias As Part Of The Result Set Column Labels?

Feb 26, 2015

Is there a way to display a column alias as part of the result set column labels?

View 9 Replies View Related

SELECT Column Aliases: Refer To Alias In Another Column?

Apr 9, 2008

Using SQL Server 2000.  How can I refer to one alias in another column?E.g., (this a contrived example but you get the idea)SELECT time, distance, (distance / time) AS speed, (speed / time) AS acceleration FROM dataNote how the speed alias is used in the definition of acceleration alias but this doesn't seem to work.

View 11 Replies View Related

SELECT Column Aliases: Refer To Alias In Another Column?

Apr 10, 2008

Using SQL Server 2000. How can I refer to one alias in another column?

E.g., (this a contrived example but you get the idea)

SELECT time, distance, (distance / time) AS speed, (speed / time) AS acceleration FROM data

Note how the "speed" alias is used in the definition of "acceleration" alias but this doesn't work.

View 14 Replies View Related

SQL Msg 107 Error... The Column Prefix Does Not Match With A Table Name Or Alias Name Used In The Query.

Nov 3, 2005

Can someone please answer a problem that I've run into.  I know that it's probably something stupid.  I keep getting this error:Server: Msg 107, Level 16, State 3, Line 1The column prefix 'vFirstTimeEntered' does not match with a table name or alias name used in the query.Here is my query:-----------------------------------------------------------------Update  TimeSheetSectionSet TimesheetSection.SECSTARTDT = vFirstTimeEntered.schlstuidWhere timesheetsection.schlstuid = vFirstTimeEntered.schlstuid AND timesheetsection.sectionid = vFirstTimeEntered.sectionid AND Timesheetsection.secstartdt < '2005-08-01'------------------------------------------------------------------vFirstTimeEntered is a view that I created.Do I need a sub query?  I know that if this was a select query I'd need to put vFirstTimeEntered in the FROM part but I don't know where it should go here.Thanks for any assistance.Scott

View 1 Replies View Related

Invalid Column Error

Jul 11, 2004

Hello all,
Does anyone see anything wrong with the sql query below


DECLARE @BUILDINGLIST nvarchar(100)
SET @BUILDINGLIST = 'ALABAMA'

DECLARE @SQL nvarchar(1024)

SET @SQL = 'SELECT id, CLOSED, building AS BUILDING FROM
requests WHERE building = (' + @BUILDINGLIST + ')'


EXEC sp_executesql @SQL


I keep on getting the following error:
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name 'ALABAMA'.


Thanks in advance.
Richard M.

View 2 Replies View Related

Invalid Column Error

Dec 12, 2014

This is my syntax, I have removed then added back line by line by line and determined it is the insert of the variable into the table that skews.

Code:
Create Table #Table1 (ID Int Identity, p nvarchar(20))
Create Table #Table2 (date datetime, salesID int, p varchar(20))
Insert into #Table1 Values ('ZeroWireless')
Declare @Str nvarchar(4000), @p nvarchar(20)
Select @p = p
From #Table1

[code]....

View 3 Replies View Related

Error 'Invalid Column Name'

Oct 2, 2005

The reference to QReceived below in the QUsageQty line gives me an error: Invalid Column Name 'QReceived'. Is there a way to reference that field?

SELECT
MEND.ProductID,
MEND.MEPeriod,
MEND.OpeningQty,
QOpenCost = MEND.OpeningDols / MEND.OpeningQty,
(SELECT Sum(UsageQty) FROM tblShipmentHdr SHPH WHERE MEND.ProductID = LEFT(SHPH.ProductID,7) And
DATEADD(mm, DATEDIFF(mm,0,SHPH.ReceivedDate), 0) = MEND.MEPeriod GROUP BY LEFT(SHPH.ProductID,7)) AS QReceived,
QUsageQty = MEND.OpeningQty + QReceived - MEND.ClosingQty,
PROD.ProductName
FROM tblMonthend MEND
LEFT OUTER JOIN dbo.tblProducts as PROD ON MEND.ProductID = PROD.ProductID
WHERE (MEND.MEPeriod =''' + convert(varchar(40),@XFromDate,121) + ''')

View 4 Replies View Related

SQL Server Invalid Column Error

Jun 8, 2004

While I'm sure I'm missing something very stupid here.... I cannot get this sproc to run successfully. I get "Error 207: Invalid Column Name tbl_images.imgID". Yes that column exists in that table, and it's case is exactly the same as what I have in the select text.

I'm baffled, any help would be great thanx!



CREATE PROCEDURE spImagesbyCategory
@categoryID varchar
AS

SELECT
tbl_products.catalogID,
tbl_products.cname,
tbl_products.cprice,
tbl_products.cdescription,
tbl_products.categoryID,
tbl_products.category,
tbl_images.catalogID,
tbl_images.imgID,
tbl_images.imgFileName

FROM tbl_products
LEFT JOIN (SELECT catalogID, MIN(imgFileName) AS imgFileName FROM tbl_images GROUP BY catalogID) tbl_images ON tbl_products.catalogID = tbl_images.catalogID
WHERE tbl_products.categoryid Like '%' + @categoryid + '%'


ORDER BY tbl_images.imgID DESC
GO

View 11 Replies View Related

Invalid Column Error With Sp_executesql

Jun 13, 2005

Hey all,

Having some trouble with a Database email system I created. The system consists of two tables, DATA_ELEMENT and EMAIL_MESSAGE. So the email message body and recipient fields may contain substitution macros such as {![CUST_EMAIL]!}. The CUST_EMAIL data element row then stores the SELECT, FROM and WHERE clauses separately. There is a stored proc to search the message body and recipients for these substitution macros and replace them with the appropriate values from the DB.

The system is working well except I have one particular substitution macro called VENUE_NAME_BY_PPPID which is causing a problem.

Quote: Server: Msg 207, Level 16, State 3, Line 3
Invalid column name 'PARTNER_PRODUCT_PRIZE_ID'.

And here's the query which is creates this error (without the escaped single quotes):


Code:

SELECT P.PARTNER_NAME + ISNULL(' - ' + PS.SITE_NAME, '')
FROM PARTNER_PRODUCT_PRIZE PPP
JOIN PARTNER_PRIZE PP ON PP.PARTNER_PRIZE_ID = PPP.PARTNER_PRIZE_ID
JOIN PARTNER P ON P.PARTNER_ID = PP.PARTNER_ID
LEFT JOIN PARTNER_SITE PS ON PS.PARTNER_ID = PP.PARTNER_ID
AND PS.PARTNER_SITE_ID = PP.PARTNER_SITE_ID
WHERE PPP.PARTNER_PRODUCT_PRIZE_ID = '19'


And just after this print statement, the query is executed with sp_executesql()

Any advice is greatly appreciated as this query runs fine when I execute from the query window. However, if I escape all the necessary quotes, I can't get it to run when I put the string inside of sp_executesql().

--Travis

View 1 Replies View Related

Error 207 - New Column Branded Invalid

May 13, 2013

I'm working in SQL2000 sp4. I've built a simple database to take snapshots from three ERPSs that contain related data and then analyse them to look for non-conforming records (items that are flagged differently between two systems, cost conversion errors, etc). The DTS packages all work fine, and suck the records out of the main systems without a problem.

For info, the DTS packages all work in the same way:
Purge a holding table
Connect to the source ERPS
Populate the holding table via a SELECT statement
Invoke a stored proc to make the required changes in the main table

Similarly, the stored procs all work in the same way: Add records from the holding table to the main table that aren't already there.

Update any records common to both: If there's a record date field, have been updated in the holding table more recently. Otherwise, match on key fields and differ on detail fields. Delete records from the main table that aren't in the holding table

The trouble started when I modified two of the tables to include the data that the record was last amended in the source ERPS. When I tried to incorporate this new column into the relevant stored proc, performing a syntax check resulted in error 207 - invalid column name.

I did some checking, and found out that stored procs tend to rely on what the table looked like when the proc was created, rather than what it now looks like. Accordingly, I tried creating a new proc. I got the same result. What have I missed?

View 8 Replies View Related

Invalid Column Name Error In Stored Procedure

Sep 19, 2012

I have a stored procedure that I am using to convert tables to a new format for a project. The project requires new tables, new fields in existing tables, dropping fields in existing tables and dropping an existing table. The SP takes care of doing all this and copying the data from the tables that are going to be dropped to the correct places. Everything is working fine except for one table and I can't figure out why.

For this particular table, it already exists in the database and has new fields added to it. Then I try and update those fields with values from another table. This is where I am getting the Invalid column name error (line is highlighted in red). If I comment out the code where the error is occurring and run the update alone everything works fine so I know the Update statement works.

Here is the specific error message I am getting in SQL Server 2005:

Msg 207, Level 16, State 1, Line 85
Invalid column name 'AssignedAgent'.
Msg 207, Level 16, State 1, Line 85
Invalid column name 'DateTimeAssigned'.

Here is the SP: -

IF OBJECT_ID('ConvertProofTables','P') IS NOT NULL
DROP PROCEDURE ConvertProofTables;
GO
CREATE PROCEDURE ConvertProofTables
AS
SET ANSI_NULLS ON

[Code] ....

View 7 Replies View Related

Analysis :: Invalid Column Name Message Type Error

May 21, 2015

I'm having trouble with cube processing. While processing a code I'm getting a "Invalid column name MessageType" error.

I unfolded the cube, then I opened "measure groups", my failing dimension (ServiceRequestDim) and the partition.

In the partition I opened the "Source" attribute so it now includes my column which was missing. But it didn't solve the issue.

If I get the query used during the process I'm getting this :

SELECT
DISTINCT
[ServiceRequestDim].[MessageType] AS [ServiceRequestDimMessageType0_0]
FROM
(
Select IsNull(IsDeleted, 0) as IsDeleted, [ServiceRequestDimKey], IsNull([Status_ServiceRequestStatusId], 0) as [Status_ServiceRequestStatusId],[Status],IsNull([TemplateId_ServiceRequestTemplateId], 0) as

[Code] ....

In the nested query which defines ServiceRequestDim the messagetype attribute is still missing. In my source datamart the ServiceRequestDim has the "MessageType" column.

So the question is where do I change the nested request that the dim process use to reflect the actual columns in my datamart .

View 4 Replies View Related

SQL Statement Not Producing Any Error For Invalid Column In A Table

Sep 2, 2006

Hi,

I am using SQL Server 2005 with SP1 patch update.I have tow tables

X table fields:

ClientID,ClientName,ClientRegisteredNumber,HoldingName,HoldingRegisteredNumber,NumberOfHoldings

Y table fields:

ClientID,ClientName,RegisteredNumber,HoldingName,HoldingRegisteredNumber,NumberOfHoldings

If i run a query for X table:

SELECT RegisteredNumber FROM X it produces the error like this

Msg 207, Level 16, State 1, Line 1

Invalid column name 'RegisteredNumber'.



But if i run the query for X,Y table:

SELECT * FROM Y WHERE RegisteredNumber NOT IN

(SELECT RegisteredNumber FROM X)

It's not producing any errors.

Why this? Is this the SQL Bug or my query problem?

Can anyone explain how to solve this?

Balaji

View 3 Replies View Related

DTS RunTime Error &#34;received Invalid Column Length From BCP Client&#34;

Jul 26, 2002

when i tried to run a DTS which transfer bulk data between 2 SQL servers, i got following error message:
================================================== ============
Error: -2147467259 (80004005); Provider Error: 4815 (12CF)
Error string: Received invalid column length from bcp client.
Error source: Microsoft OLE DB Provider for SQL Server
Help file:
Help context: 0
================================================== ===========

if anybody has encounter the same problem before? after testing, i think it's
must related with network traffic problem. but i can not figure out how to solve it.

View 2 Replies View Related

Transact SQL :: Using Bulk Insert - Invalid Column Number In Format File Error

Jun 5, 2015

I try to import data with bulk insert. Here is my table:

CREATE TABLE [data].[example](
 col1 [varchar](10) NOT NULL,
 col2 [datetime] NOT NULL,
 col3 [date] NOT NULL,
 col4 [varchar](6) NOT NULL,
 col5 [varchar](3) NOT NULL,

[Code] ....

My format file:

10.0
7
1  SQLCHAR 0  10 "@|@" 2 Col2 ""
1  SQLCHAR 0  10 "@|@" 3 Col3 ""
2  SQLCHAR 0  6 "@|@" 4 Col4 Latin1_General_CI_AS

[Code] .....

The first column should store double (in col2 and col3) in my table

My file:
Col1,Col2,Col3,Col4,Col5,Col6,Col7
2015-04-30@|@MDDS@|@ADP@|@EUR@|@185.630624@|@2015-04-30@|@MDDS
2015-04-30@|@MDDS@|@AED@|@EUR@|@4.107276@|@2015-04-30@|@MDDS

My command:
bulk insert data.example
from 'R:epoolexample.csv'
WITH(FORMATFILE = 'R:cfgexample.fmt' , FIRSTROW = 2)

Get error:
Msg 4823, Level 16, State 1, Line 2
Cannot bulk load. Invalid column number in the format file "R:cfgexample.fmt".

I changed some things as:
used ";" and "," as column delimiter
changed file type from UNIX to DOS and adjusted the format file with "
" for row delimiter

Removed this line from format file
1  SQLCHAR 0  10 "@|@" 2 Col2 ""
Nothing works ....

View 7 Replies View Related

SQL: Giving A Column A Formula

Jun 17, 2008

I have 3 columns, all integers. [col1] [col2] [col3]
Is it possible to assing a formula to [col3] which always takes the sum of [col1] & [col2]?

View 3 Replies View Related

Several Alias For The Same Column

Mar 2, 2005

In SQLServer I can't change my SQL column name.

But I need to see another field name in query tool (Excel)

How can I do that (alias..., description ?

Thanks

View 1 Replies View Related

Column Alias

Aug 30, 2006

Hello everyone.

I was wondering if there is a way that you can set the alias name of a column to a value that resides in another table instead of the alias being a static value that you type in.

If anyone has any ideas on ho i can accomplish this i would greatly appreciate it.

View 14 Replies View Related

Order By Column Alias

Feb 12, 2007

I'm using SQL Server 2005 and are having some troubble with sorting a paged result set. I'm using the OVER Clause to achieve the sorting and paging and have the following query:1 WITH ProjectList AS
2 (
3 SELECT
4 Id,
5 Name,
6 Created,
7 (SELECT COUNT(*) FROM UserProjects WHERE ProjectId = p.Id) AS NumberOfUsers,
8 ROW_NUMBER() OVER (ORDER BY Id) AS 'RowNumber'
9 FROM Projects p
10 )
11 SELECT *
12 FROM ProjectList
13 WHERE RowNumber BETWEEN 50 AND 60;

This works fine, and give me the results i want. The problem occurs when I want to sort by "NumberOfUsers" which is the results of a sub query.When i say "ORDER BY NumberOfUsers" instead of Id on line 8, I get the following error:
Msg 207, Level 16, State 1, Line 10Invalid column name 'NumberOfUsers'.
I read this in the documentation:
When used in the context of a ranking window function, <ORDER BY Clause> can only refer to columns made available by the FROM clause. An integer cannot be specified to represent the position of the name or alias of a column in the select list. <ORDER BY Clause> cannot be used with aggregate window functions.
So this means that what I'm trying to do is not possible. How can I then sort by NumberOfUsers? Is there any other way to achieve this

View 4 Replies View Related

Column Alias In Views

Oct 31, 2005

Hi All,
I am currently transferring my Access application to SQL Server. Access allows you to declare and use aliases in the query at the same time.

e.g.
Select field1 as Alias1, field2 as Alias2, Alias1 & " " & Alias2 as Alias3 from table1;

In Access the above query will execute perfectly, no problem. However in SQL Server, if you try to run the same query it will give an error "Invalid column name Alias1" meaning that SQL Server is searching for Alias1 as a field in the table, not as an alias from the query.

My question is does SQL Server have a facility to declare and use alias directly as in Access and if no, is there a workaround?

Thanks for your time.

Regards:
Prathmesh

View 8 Replies View Related

Using Column Alias In SELECT (was Asking)

Nov 25, 2006

Hi,

I have a question.

select name, count, 1 Aa c1, 2 as c2, c1+c2 As total
from table1

From this example, the program will give out error message,
c1, and c2 are invalid columns.

In MS Access, it works. But, SQL query Analayer doesn't work this statement.
So, does query analayzer handle this case?

Thanks.

View 3 Replies View Related

Column Name Alias Concatenation

Feb 20, 2004

I have a web application where I would like to return a dynamic column name using aliasing. below is an example:

select hours as 'Fri<BR>' + cast(Day(getDate()) as varchar(2)) from todayshours

I get an error trying to do concatenation as part of the alais. Any ideas?

Luke
lgraunke AT 4invie.com

View 4 Replies View Related

Use Column Alias In Another Calculation

Jul 20, 2005

Is there a way to use a column alias in an another calculation within thesame query? Since I am using some long and complex logic to compute total1and total2, I don't want to repeat the same logic to compute the ratio ofthose two columns. I know that I can do a nested query, but that seems toolengthy as well since I actually have many, many columns.selecttotal1 = sum(case(long complex logic)),total2 = sum(case(another long complex logic)),ratio = total1/total2

View 6 Replies View Related

Column Alias As Variable

Jun 28, 2006

Is there a way to select a column as an alias using a variable for the alias? something like this:

SELECT Column1 as @myVariable FROM Table1

View 4 Replies View Related

Multi Column Subquery? W/ Alias

Jun 12, 2008

What I need to do is to create 3 columns with 3 different aliases from the same table that will return all the values during the following conditions:

when pricelist = 1

when pricelist = 2

when pricelist = 3


pricelist
--------
1
2
3


Price
--------
912 -- (linked with 1)
234 -- (linked with 3)
56 -- (linked with 2)
3245 -- (linked with 3)
234 -- (linked with 1)
65 -- (linked with 2)

these 2 columns are in the same table^^

so what i want my query to generate is:

Price1
--------
912
234

Price2
--------
56
65

Price3
--------
234
3245

Any help is apprecieated, thanks

if the above does not make sense to you maybe this will:
"can you make 3 aliases of the same column and only display the rows inside each column where pricelist = 1 for the 1st alias... where price = 2 for the 2nd alias...where pricelist = 3 for the 3rd alias"

View 10 Replies View Related

Using Alias Column Names For Calculations

Oct 3, 2007

Hi,
I want to have a query where in i can use alias column names in the same query.
like eg
select 1 as 'a', 2 as 'b', a+b as 'c'

note that this query is getting big and is using sub queries.


Kindly help.

Thanks

View 5 Replies View Related

Help...!! Can We Compare Alias Of Column Within The Same Query??

Feb 22, 2007

Can We Compare alias of column(Derived column) within the same query??

Ex:

Select (abc+50)*100 as 'WXY' from XYZ where WXY>150

.....

I cant execute such statement ... Can anyone help me how to comapre the alias within the same query..?

View 3 Replies View Related

Dataset Query With Alias Column And Allow Searches

Jul 13, 2005

I have a form that loads a dataset.  This dataset is composed from SQL statements using alias and unions.  Basically it takes uses data from 3 tables.  This dataset also has a alias column called ClientName that consists of either people's name or business name.In addition, the form also consist of a search field that allows user to enter the 'ClientName' to be searched (i.e. to search the alias column).  So, my question is how can the alias column be searched (user can also enter % in the search field)Function QueryByService(ByVal searchClientNameText As String) As System.Data.DataSet
If InStr(Trim(searchClientNameText), "%")>0 Then            searchStatement = "WHERE ClientName LIKE '" & searchClientNameText & "'"Else             searchStatement = "WHERE ClientName = @searchClientNameText"End If
Dim queryString As String = "SELECT RTrim([People].[Given_Name])"& _"+ '  ' + RTrim([People].[Family_Name]) AS ClientName, [Event].[NumEvents],"& _"[Event].[Event_Ref]"& _"FROM [Event] INNER JOIN [People] ON [Event].[APP_Person_ID] = [People].[APP_Person_ID]"& _searchStatement + " "& _"UNION SELECT [Bus].[Organisation_Name],"& _"[Event].[NumEvents], [Event].[Event_Ref]"& _"FROM [Bus] INNER JOIN [Event] ON [Bus].[APP_Organisation_ID] = [Event].[APP_Organisation_ID] "& _searchStatement
..........End Function

View 2 Replies View Related

The Column Prefix 'MS1' Does Not Match With A Table Name Or Alias Name Used In The...

Aug 29, 2007

I have an Access database, that is in connection with sql server.
On my computer with access2007 i have no problems with viewing tables and stuff.

But on other computers with access2003 it gives an error when i use this query:

INSERT INTO [tbl_sap-staffel] ( ItemCode, CardCode, [Amount-0], [Price-0], [Amount-1], [Price-1], [Amount-2], [Price-2] )
SELECT [qry_sap-spp-0].ItemCode, [qry_sap-spp-0].CardCode, [qry_sap-spp-0].Amount, [qry_sap-spp-0].Price, [qry_sap-spp-1].Amount, [qry_sap-spp-1].Price, [qry_sap-spp-2].Amount, [qry_sap-spp-2].Price
FROM ([qry_sap-spp-0] LEFT JOIN [qry_sap-spp-1] ON ([qry_sap-spp-0].ItemCode = [qry_sap-spp-1].ItemCode) AND ([qry_sap-spp-0].CardCode = [qry_sap-spp-1].CardCode)) LEFT JOIN [qry_sap-spp-2] ON ([qry_sap-spp-1].ItemCode = [qry_sap-spp-2].ItemCode) AND ([qry_sap-spp-1].CardCode = [qry_sap-spp-2].CardCode);


It says:
ODBC call failed
[Microsoft][ODBC SQL Server Driver][SQL Server]
The column prefix 'MS1' does not match with a table name or alias name used in the query.
The column prefix 'MS2' does not match with a table name or alias name used in the query.

And it will give this error 6 times.

I dont know what to do.
Can anybody help me?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved