Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. error?

error?

Scheduled Pinned Locked Moved Database
helpdatabasequestionannouncement
10 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    suni_dotnet
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • S suni_dotnet

      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

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Are you sure that columns RoomID and Avaliable exists in table PresidentialSuite? 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.

      S 1 Reply Last reply
      0
      • B Blue_Boy

        Are you sure that columns RoomID and Avaliable exists in table PresidentialSuite? 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.

        S Offline
        S Offline
        suni_dotnet
        wrote on last edited by
        #3

        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 ','.

        B 1 Reply Last reply
        0
        • S suni_dotnet

          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 ','.

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          this T-SQL codeselect (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.

          S 1 Reply Last reply
          0
          • B Blue_Boy

            this T-SQL codeselect (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.

            S Offline
            S Offline
            suni_dotnet
            wrote on last edited by
            #5

            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';

            B 1 Reply Last reply
            0
            • S suni_dotnet

              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';

              B Offline
              B Offline
              Blue_Boy
              wrote on last edited by
              #6

              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.

              S 1 Reply Last reply
              0
              • B Blue_Boy

                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.

                S Offline
                S Offline
                suni_dotnet
                wrote on last edited by
                #7

                its not working same old error multipart identifier PresidentialSuite.RoomID cannot be bound.............

                B 1 Reply Last reply
                0
                • S suni_dotnet

                  its not working same old error multipart identifier PresidentialSuite.RoomID cannot be bound.............

                  B Offline
                  B Offline
                  Blue_Boy
                  wrote on last edited by
                  #8

                  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.

                  S 1 Reply Last reply
                  0
                  • B Blue_Boy

                    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.

                    S Offline
                    S Offline
                    suni_dotnet
                    wrote on last edited by
                    #9

                    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

                    B 1 Reply Last reply
                    0
                    • S suni_dotnet

                      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

                      B Offline
                      B Offline
                      Blue_Boy
                      wrote on last edited by
                      #10

                      You are welcome.


                      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.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups