Table

  • It's quiet strange when i expand database - tables - i see a table by name dbo.db.documents. when i run a select query from the query window - i get a message Table 'Document' does not exist. When i view open the same table from the enterprise manager - it does open it.

    also i tried refering the table with the syntax dbo.db.document - db.document or just document. but no luck. anyone knows whats going on?

    Apprecaited any input.

    thanks,

  • does select * from dbo.[db.documents] work?

  • Have you tried this syntax? :::

    SELEC Whatever FROM dbo.[db.documents]

    if that fails you can always run this to see the actual table name

    Select * from sys.sysobjects where name like %documents% and Xtype = 'U'

    Once you figure out the actual name, I may suggest you rename it to avoid further problems. This assumes that the system is still in dev mode of course.

    Best of luck.

  • select * from db.document does not work. strange.

    when i ran the following query - Select * from sysobjects where name like '%document%' and Xtype = 'U' - i do see db.document listed in the resultset. unfortunately when trying to run a select - it says - Invalid object name 'DB.Document'.

    Am i missing anything?

  • use brackets:

    select * from dbo.[db.documents]

    type the select statement exactly as shown above, with brackets surrounding db.documents. in other words, db.documents becomes [db.documents]

  • Do you have all the correct permissions on the table? You may be able to view it but not actually select from it...

  • i am running the select from SA. Also it says, invalid object which according to me is not permissions but object problem.

  • It has to work if you put the name that sysobjects gives you in brackets... that's absolutly a can't fail proposition... unless you have a corrupt installation or maybe DB (hypothesis here).

  • Are you sure you are connected to the right server / DB?

  • Yes, it is a object problem. If I am not mistaken, you created the table with the name "db.document". If this is the case, then you will have issues.

    SQL Query engine works just like .NET Assemble naming convention. In SQL Server it is

    Now when you try to access object [db.Document], it is trying to look inside the schema db and not DBO.

    This is what I think is the issue. Maybe I am wrong

    -Roy

  • No, you're dead on...

    I've seen names like this: l'aéropt du-Québec

    That's the tablename... and I can access it with brackets, so a simple dot should not stop it!

  • I am 200% sure - I am running against the correct database. I even ran the following statement:

    select * from dbo.db.document --- This too failed.

    what's the other alternative? There gotta be some easy way around this?

  • copy this line:

    select * from dbo.[db.documents]

    paste it into your query window.

    run it.

    does it work?

    i'm only repeating this because every example you give does NOT have the brackets.

  • select * from dbo.[db.document]

    That works for me.

    CREATE TABLE dbo.[db.documents]

    ( a int

    )

    GO

    INSERT INTO dbo.[db.documents] (a) values (1)

    SELECT a FROM dbo.[db.documents]

    GO

    DROP TABLE dbo.[db.documents]

    GO

  • Lenny - Ran your code and no luck.

    select * from dbo.[db.documents]

    Msg 208, Level 16, State 1, Line 1

    Invalid object name 'dbo.db.documents'.

    same error message.

Viewing 15 posts - 1 through 15 (of 20 total)

You must be logged in to reply to this topic. Login to reply