Results 1 to 3 of 3

Thread: How to drop a table if exists in a SQL Script CE

  1. #1
    Join Date
    Apr 2009
    Posts
    102

    How to drop a table if exists in a SQL Script CE

    Can any body tell me that how can to drop a table if exists in a SQL Server CE. Can any body tell me that how can i do so? Does any body knows about it? Kindly provide me the correct solution for teh above issue. Any kind of information on the above issue would be appreciated.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to drop a table if exists in a SQL Script CE

    You can try out the following code:-

    select count(*) from information_schema.tables where table_name='Action'
    if the result is > 0, that means the table exists.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to drop a table if exists in a SQL Script CE

    In order to test the existence of a given table in SQL Compact, you have to query the INFORMATION_SCHEMA.TABLES view, something like:

    SELECT * FROM INFORMATION_SCHEMA.TABLES
    Look for the table name in the TABLE_NAME column. For that you can also use the table name in a WHERE clause, like:

    SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'table name to test'
    Hope so it may help you out.

Similar Threads

  1. Replies: 3
    Last Post: 14-12-2011, 11:13 AM
  2. Drop In/Drop Out Split Screen in Resistance 3
    By Bubboy in forum Video Games
    Replies: 5
    Last Post: 20-08-2011, 10:48 PM
  3. Link a Table to another Table to Drop Down In Main Table
    By himeshRES in forum Windows Software
    Replies: 6
    Last Post: 11-12-2010, 02:01 PM
  4. How to make table drop down menu
    By Odalis in forum Software Development
    Replies: 3
    Last Post: 13-07-2009, 06:43 PM
  5. Check if database or table exists
    By Xan in forum Software Development
    Replies: 2
    Last Post: 29-05-2009, 04:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,051,625.51662 seconds with 16 queries