invalid object name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ng1426
    New Member
    • May 2010
    • 5

    invalid object name

    Hiii

    I have created a database named db2

    after that i created 4 tables -
    1.Friends and used insert,select etc commands

    2 then product_master and used insert,select ,uodate etc commands
    similarly employees table and t4 table

    my problem is that after inserting the records in the last table t4 when i accessed the table Friends there is an error


    Msg 208, Level 16, State 1, Line 1
    Invalid object name 't4'.

    what to do????

    help
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    How are you trying to access this table? Can you access the other tables, or is t4 the only problem table?

    Comment

    • ng1426
      New Member
      • May 2010
      • 5

      #3
      its like if i m using the query select * from employees m getting the result bt on the other hand if m using select * from t4 m getting this error

      Comment

      • ng1426
        New Member
        • May 2010
        • 5

        #4
        only prblm is with t4 table

        Comment

        • jkmyoung
          Recognized Expert Top Contributor
          • Mar 2006
          • 2057

          #5
          Please show the code where you're creating the table. Are you getting confirmation that the table is actually created?

          Comment

          • ng1426
            New Member
            • May 2010
            • 5

            #6
            create table Product_table(p _group varchar(20),nam e varchar(20),sel ling_price varchar(20))
            insert into Product_table values('4','Bri tania','60')
            insert into product_table values('1','hea d and shoulder','149' )
            insert into product_table values('1','Kis san','92')
            select * from product_table
            select * into product from product_table where 1=2
            select * from product
            alter table product alter column selling_price int
            select * from product
            insert into product (p_group,name,s elling_price) select p_group,name,se lling_price from product_table where p_group=1
            update product set selling_price=' selling_price+( 5/100*selling_pri ce)' where p_group=1
            and the error is
            Msg 245, Level 16, State 1, Line 1
            Conversion failed when converting the varchar value 'selling_price+ (5/100*selling_pri ce)' to data type int.


            how to resolve it

            help?

            Comment

            • ng1426
              New Member
              • May 2010
              • 5

              #7
              jkmyoung thanx for replying...dat prblm has been solved..

              now m facing another prblm.i have pasted it please go through it...

              Comment

              • jkmyoung
                Recognized Expert Top Contributor
                • Mar 2006
                • 2057

                #8
                Use Cast or convert the varchar to an int, eg similar examples:
                Code:
                SELECT CAST(YourVarchar AS INT) FROM Product_Table
                SELECT CONVERT(INT, YourVarchar) FROM Product_Table

                Comment

                Working...