Error in stored procedure

A

Angelina

Hi,

I just wanted to ask what is wrong with this stored
procedure. i keep getting the following error message:

ADO error: The column prefix 'dbo' does not match with a
table name or alias name used in the query.


ALTER PROCEDURE dbo.SPSelEquipBooked2
(@Arrival datetime,
@Departure datetime)

AS
SELECT dbo.Equip_Inv_No
FROM dbo.Equipment_Inv
WHERE dbo.equipment_Inv.Equipment_Inv_No
Not In(
SELECT dbo.Equipment_Inv.Equip_Inv_No
FROM dbo.Equipment_Booking INNER JOIN
dbo.Equipment_Inv ON
dbo.Equipment_Booking.Equip_Inv_No =
dbo.Equipment_Inv.Equip_Inv_No INNER JOIN
dbo.Caravan_booking ON
dbo.Equipment_Booking.BookingNo =
dbo.Caravan_booking.BookingNo AND
dbo.Equipment_Booking.Caravan_Inv_No =
dbo.Caravan_booking.Caravan_Inv_No INNER JOIN
dbo.Booking_Details ON dbo.Caravan_booking.BookingNo
= dbo.Booking_Details.BookingNo
WHERE (dbo.Booking_Details.Dt_of_departure >= @Arrival)
AND (dbo.Booking_Details.Dt_of_arrival <= @Departure))


thx in advance
 
B

bruce barker

in your first select

SELECT dbo.Equip_Inv_No

you refer to table dbo, which is not specified in the query, just like the
message say's.
 
A

Angelina

Hi Bruce,

I though you prefix all tables with dbo ?
what is this for anyway?
The bottom half of my query runs properly buy when i add
the top half i get the error message.
What do u suggest i change this sql code to?
I do not have sql server so i cannot run this code in the
sql query analyzer. I am using msde.

thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top