logo
down
shadow

Drop SQLite tables using list of tables names


Drop SQLite tables using list of tables names

By : user2957405
Date : November 24 2020, 01:01 AM
it should still fix some issue You can drop tables using a SQL command in SQLite. All you need to do is iterate over your collection and build a SQL string each time, and execute it
code :
List<string> models = new List<string> { "WebBrowser", "Notebook", "Members"};

foreach (string mod in models)
{
    using (var dbConn = new SQLiteConnection(app.DBPath))
    {
        SQLiteCommand command = new SQLiteCommand(dbConn);
        command.CommandText = string.Format("DROP TABLE {0};", mod);
        command.ExecuteNonQuery();
    }
}


Share : facebook icon twitter icon
How to drop all empty tables in SQLite?

How to drop all empty tables in SQLite?


By : user1779680
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Tables can be dropped, whether or not they have data in them when the command is executed. Dunno of any database that operates otherwise. So that means:
1) Getting a list of tables -
code :
SELECT name 
  FROM sqlite_master
 WHERE type = 'table'
SELECT COUNT(*) 
  FROM ~table
DROP TABLE ~table
sqlite tables don't need column names?

sqlite tables don't need column names?


By : Voja Lazic
Date : March 29 2020, 07:55 AM
will be helpful for those in need In sqlite I was able to create a table with the following command: , But they became names instead of datatypes:
code :
sqlite> create table myTable(varchar, date, int);
sqlite> .headers on
sqlite> insert into myTable Values(1,1,1);
sqlite> select * from myTable;
varchar|date|int
1|1|1
Searching for list of tables from tab when only partial names of the tables are present

Searching for list of tables from tab when only partial names of the tables are present


By : sunrist1
Date : March 29 2020, 07:55 AM
will help you I want to get the list of tables from tab , but I only have partial names of the tables :- , This should be ok:
code :
SELECT COLUMN_NAME1 PATTERN, U.TABLE_NAME
FROM TABLE_NAME T, USER_TABLES U
WHERE REGEXP_INSTR(U.TABLE_NAME, '(^|_)' || T.COLUMN_NAME1 || '($|_)') != 0
Cannot Truncate and Drop Tables in SQLite

Cannot Truncate and Drop Tables in SQLite


By : user3404088
Date : March 29 2020, 07:55 AM
wish helps you You can easlity configure SQLite with swift using single ton class as well.
You just need to pass your query in related function's argument.
code :
func methodToCreateDatabase() -> NSURL?{} 
func methodToInsertUpdateDeleteData(strQuery : String) -> Bool{}
func methodToSelectData(strQuery : String) -> NSMutableArray{}
Drop all tables with exceptions in sqlite

Drop all tables with exceptions in sqlite


By : R. Toy
Date : March 29 2020, 07:55 AM
seems to work fine I saw this question where it is presented a command to drop all tables from an sqlite database. Is it possible to add exceptions, i.e., drop all tables except table X Y and Z?
code :
PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type = 'table' AND name NOT IN ('X', 'Y', 'Z');
PRAGMA writable_schema = 0;
VACUUM;
SELECT 'DROP TABLE ' || name || ';' FROM sqlite_master
    WHERE type = 'table' AND name NOT IN ('X', 'Y', 'Z');
Related Posts Related Posts :
  • Stop Continuation Task upon exception thrown from parent task
  • Is there a way to make msbuild write error output to stderr?
  • Unit testing: TDD with POCO Objects with navigation properties (relationship fixup)
  • GridSplitter disables my RowDefinition style
  • Memory leak only in Release mode
  • how to read specified string from url
  • how to store html code EMail template in a string variable or textbox c#
  • Set Selected Date to TimePicker wpf (TimePickers inside DataTemplate)
  • How to draw line in Silverlight Specifying Height?
  • Stored procedure executes but does not update data
  • ASP.NET ListBox Trouble
  • Why does C# also not allow empty conditions in while loops?
  • Unable to get a block of code into my regex match groups
  • What is difference between dbcontext.Add and dbcontext.AddObject
  • How do I update the file version number of C# DLL without recompiling?
  • Value for html control always null
  • HttpClient hangs when timeout is setting (Windows Phone)
  • Handle Multiple Form tag in asp.net page?
  • create word document with html content in c#
  • Confusion about Find And Replace
  • Format sms messages in Clickatell
  • Automated Function Overload
  • String to date in MS Access SQL statement gives type mismatch error
  • ShowDialog exiting on certain events
  • Is there a try Convert.ToInt32... avoiding exceptions
  • How to move wpf application into minimize tray at Window Start-up C#?
  • How to change display format of long variable?
  • How to use Addfields in MongoDB C# Aggregation Pipeline
  • MsTest TestCleanup method not called when an unhandled exception is thrown
  • missing last data when exporting gridview to excel
  • How to add array of objects to List in c#
  • Lambda Expression to order (sort) my list collection
  • Library for displaying music notation
  • How to compare two dictionaries in c# and get the output as True and False after validation
  • specify fields to be serialized with JSON
  • How do you obtain the content of a specific node using XmlDocument in C#?
  • How to ignore the first line in a csv file when you read the csv file in C#
  • c# - Problem calling public void from class
  • How to tell a class which objects it should create? Type vs. object confusion :(
  • Save CheckBox state to xml
  • WIX CAQuietExec NETSH Command Fails
  • Issues sending http put request every 60 seconds to RoR app
  • ConfigurationManager.ConnectionStrings.ConnectionString Issue
  • Real size WPF controls for printing
  • How to cancel properly?
  • C# String multiplication error
  • Using Solrnet and Assigning Attributes with Entity Framework Generated POCOs
  • Regex pattern for single backslash
  • TextBox: insert spaces for credit card number?
  • C# DLL loaded for exe-application is not found when launching similar DLL by rundll32.exe
  • Debug a Windows Service with WCF library
  • Open a file from an external assembly?
  • Servicestack RegistrationFeature Unable to bind request
  • Index was outside the bounds of the array confusion
  • Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name
  • I am trying to do a while loop with a string conditional statement in C#
  • C# 'Cannot access a disposed object. Object name: 'SslStream'.'
  • How to make Gecko use seperate CookieContainer per instance?
  • C# Advanced form "please wait"
  • Send and Receive data C# using network stream
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org