How can i determine if a table exists in SqlCE?

  • i want to check if there is a table named 'Table1' in SqlCE file on my device.

    how can i check it?

    thanx...

  • noname (11/12/2007)


    i want to check if there is a table named 'Table1' in SqlCE file on my device.

    how can i check it?

    thanx...

    The compact edition supports the information_schema, so you can query this to find out whether a particular table exists:

    SELECT * FROM INFORMATION_SCHEMA.TABLES

    should give you all the tables for example.

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • I know this is an old post, but in case anyone else runs across the problem....My REAL easy way to check if a table exists is to try to create it, if it already exists, simply catch the exception...maybe not the best way, but I got tired of messing with the sqlCE trying to do this.

    Catch ex As SqlServerCe.SqlCeException

    If ex.Message.Contains("The specified table already exists.") Then

    Return True 'Table Exists...or return ex...

    End If

  • hi

    where i will write this select statement

    SELECT * FROM INFORMATION_SCHEMA.TABLES

    in my program.

    is there any editor execute this like oracle and sql server 2005

    or we have to use is programmatically

    thanx

  • Select * from Tab before exicuting query First select Databe at right side:P

Viewing 5 posts - 1 through 4 (of 4 total)

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