error?
-
Hi All, Iam Newbie... IF EXISTS (SELECT RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping FROM HouseKeeping) UPDATE HouseKeeping SET DateWhenFilled=PresidentialSuite.DateWhenFilled, DateWhenFree=PresidentialSuite.DateWhenFree, TimeForHouseKeeping=PresidentialSuite.TimeForHouseKeeping where (HouseKeeping.RoomID = PresidentialSuite.RoomID and PresidentialSuite.Available='no') ELSE INSERT INTO HouseKeeping (RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping) select PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree, PresidentialSuite.TimeForHouseKeeping from PresidentialSuite where PresidentialSuite.Available='no'; Structure of both tables are not same. with this Stored Procedure, Iam getting the error... Msg 4104, Level 16, State 1, Line 4 The multi-part identifier "PresidentialSuite.RoomID" could not be bound. Msg 4104, Level 16, State 1, Line 4 The multi-part identifier "PresidentialSuite.Available" could not be bound. Iam unable to find, what the error is? Please help
-
Hi All, Iam Newbie... IF EXISTS (SELECT RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping FROM HouseKeeping) UPDATE HouseKeeping SET DateWhenFilled=PresidentialSuite.DateWhenFilled, DateWhenFree=PresidentialSuite.DateWhenFree, TimeForHouseKeeping=PresidentialSuite.TimeForHouseKeeping where (HouseKeeping.RoomID = PresidentialSuite.RoomID and PresidentialSuite.Available='no') ELSE INSERT INTO HouseKeeping (RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping) select PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree, PresidentialSuite.TimeForHouseKeeping from PresidentialSuite where PresidentialSuite.Available='no'; Structure of both tables are not same. with this Stored Procedure, Iam getting the error... Msg 4104, Level 16, State 1, Line 4 The multi-part identifier "PresidentialSuite.RoomID" could not be bound. Msg 4104, Level 16, State 1, Line 4 The multi-part identifier "PresidentialSuite.Available" could not be bound. Iam unable to find, what the error is? Please help
Are you sure that columns
RoomID
andAvaliable
exists in tablePresidentialSuite
? For more info check this google result[^].
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
Are you sure that columns
RoomID
andAvaliable
exists in tablePresidentialSuite
? For more info check this google result[^].
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
thanks for ur reply.. yes, they exist. and RoomID is primary key. and if i modify the select statement (i just added braces and no other changes) select (PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree,PresidentialSuite.TimeForHouseKeeping) then iam getting this error: Msg 102, Level 15, State 1, Line 14 Incorrect syntax near ','.
-
thanks for ur reply.. yes, they exist. and RoomID is primary key. and if i modify the select statement (i just added braces and no other changes) select (PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree,PresidentialSuite.TimeForHouseKeeping) then iam getting this error: Msg 102, Level 15, State 1, Line 14 Incorrect syntax near ','.
this T-SQL code
select (PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree,PresidentialSuite.TimeForHouseKeeping)
is not completed,it must contain from caluse to specify from which table those columns comes.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
this T-SQL code
select (PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree,PresidentialSuite.TimeForHouseKeeping)
is not completed,it must contain from caluse to specify from which table those columns comes.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
yeah, it has from clause and where clause too... INSERT INTO HouseKeeping (RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping) select PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree,PresidentialSuite.TimeForHouseKeeping FROM PresidentialSuite where PresidentialSuite.Available='no';
-
yeah, it has from clause and where clause too... INSERT INTO HouseKeeping (RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping) select PresidentialSuite.RoomID,PresidentialSuite.DateWhenFilled,PresidentialSuite.DateWhenFree,PresidentialSuite.TimeForHouseKeeping FROM PresidentialSuite where PresidentialSuite.Available='no';
try this
INSERT INTO HouseKeeping select RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping FROM PresidentialSuite where Available='no';
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
try this
INSERT INTO HouseKeeping select RoomID,DateWhenFilled,DateWhenFree,TimeForHouseKeeping FROM PresidentialSuite where Available='no';
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
its not working same old error multipart identifier PresidentialSuite.RoomID cannot be bound.............
-
its not working same old error multipart identifier PresidentialSuite.RoomID cannot be bound.............
CREATE TABLE [dbo].[HouseKeeping] ( [RoomID] [int] NULL, [DateWhenFilled] [varchar](50) NULL, [DateWhenFree] [varchar](50) NULL, [TimeForHouseKeeping] [varchar](50) NULL ) ____________________________________________________ CREATE TABLE [dbo].[PresidentialSuite] ( [RoomID] [int] NULL, [DateWhenFilled] [varchar](50) NULL, [DateWhenFree] [varchar](50) NULL, [TimeForHouseKeeping] [varchar](50) NULL, [Avaliable] [varchar](50) NULL ) _____________________________________________________ Insert Into PresidentialSuite Values(1,'2009.03.06','2009.03.06','20','yes') Insert Into PresidentialSuite Values(2,'2009.03.06','2009.03.06','20','no') Insert Into PresidentialSuite Values(3,'2009.03.06','2009.03.06','20','no') INSERT INTO HouseKeeping SELECT RoomID, DateWhenFilled, DateWhenFree, TimeForHouseKeeping FROM PresidentialSuite WHERE avaliable='no' SELECT * FROM HouseKeeping
The last select statement should return you two inserted rows in table HouseKeeping. Hope this will hel you.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
CREATE TABLE [dbo].[HouseKeeping] ( [RoomID] [int] NULL, [DateWhenFilled] [varchar](50) NULL, [DateWhenFree] [varchar](50) NULL, [TimeForHouseKeeping] [varchar](50) NULL ) ____________________________________________________ CREATE TABLE [dbo].[PresidentialSuite] ( [RoomID] [int] NULL, [DateWhenFilled] [varchar](50) NULL, [DateWhenFree] [varchar](50) NULL, [TimeForHouseKeeping] [varchar](50) NULL, [Avaliable] [varchar](50) NULL ) _____________________________________________________ Insert Into PresidentialSuite Values(1,'2009.03.06','2009.03.06','20','yes') Insert Into PresidentialSuite Values(2,'2009.03.06','2009.03.06','20','no') Insert Into PresidentialSuite Values(3,'2009.03.06','2009.03.06','20','no') INSERT INTO HouseKeeping SELECT RoomID, DateWhenFilled, DateWhenFree, TimeForHouseKeeping FROM PresidentialSuite WHERE avaliable='no' SELECT * FROM HouseKeeping
The last select statement should return you two inserted rows in table HouseKeeping. Hope this will hel you.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
hi, i didnot use from clause in the first part and used in the second part. From clause in set solved my problem thanks alot
-
hi, i didnot use from clause in the first part and used in the second part. From clause in set solved my problem thanks alot