Friday, September 23, 2016

Building up a table in SQLite using Visual Studio 2015

SQLite's Build Table...creates a UI interface to design the columns to create a script for creating a table.

It will be assumed that you have installed the necessary extensions.
-
If you do not have SQLite follow this link.
If you do not have Visual Studio 2015 Community go here.
--
This is how the SQL Compact/SQLite Toolbox connections look like. There are three nodes, Tables, Views and Triggers and they are all empty.


Table_SQLite_00

Right click table to get this drop-down


Table_SQLite_01


Click on Build Table(beta)...
Build Table window appears as shown.




Table_SQLite_02


Give a name to the table(herein Sept22) and insert the columns you want in the table as shown where the Fname column with nvarchar() data type has been added (still incomplete).




Table_SQLite_03

We have finished adding a few more columns as shown.


Table_SQLite_04

Now the option is to click Script!. Click Script!.
The script is created as shown.
---
-- Script Date: 9/22/2016 6:07 PM  - ErikEJ.SqlCeScripting version 3.5.2.58
CREATE TABLE [Sept22] (
  [Id] INTEGER NOT NULL
, [Fname] nvarchar(50) NULL
, [LName] nvarchar(50) NOT NULL
, [Age] int NOT NULL
, CONSTRAINT [PK_Sept22] PRIMARY KEY ([Id])
);

-----
Now all that remains is to run this code. Click on the icon for execute as shown.




Table_SQLite_05

This creates the table as shown.


Table_SQLite_06

Of course the table is empty it has only the meta data that we have incorporated.