[sqlite] Temporary table in SQLite

2016-02-14 Thread ad...@shuling.net
Hi,

Is it possible to create a temporary table in SQLite so that it will only be
visible to the current session and be destroyed after the session is closed?
Just like SQL Server
http://www.codeproject.com/Articles/42553/Quick-Overview-Temporary-Tables-in
-SQL-Server ?

Thanks





[sqlite] Temporary table in SQLite

2016-02-14 Thread R Smith
Yes, you can do:

CREATE TEMP TABLE t (a, b, etc);

and it will only persist the duration of the current connection. i.e. 
Once you Close the DB connection, that table is no more, and even while 
the connection is open, it is only visible to the connection which 
created it.

There are even ways to make the temp table be in memory only and other 
advanced options, but you need to read the documents for more 
information. You can start here:
http://sqlite.org/lang_createtable.html

You will definitely need to read up on Type conventions in SQLite, since 
it might not work as expected in MSSQL - for instance, a column declared 
as "aCol VARCHAR(50)" will work, but it won't limit the field to only 50 
characters, it will happily store up to 2 Gigabytes in there. Read here:
https://www.sqlite.org/datatype3.html

I assume you are somewhat new to SQLite coming from an MSSQL background, 
so allow me to mention that, apa`r`t from Temp tables, you can also 
create Views and use Common Table Expressions (just like in MSSQL). 
Documentation is easy to find from the site, but if you have any 
specific questions, please ask here.

Some good free DB Admin programs out there will make learning it easy 
with SQL examples and the like. You could try DB Browser for SQLite 
http://sqlitebrowser.org/ with multi-platform support or, if you use 
Windows, SQLitespeed http://www.sqlc.rifin.co.za/

Good luck,
Ryan


On 2016/02/14 5:13 AM, admin at shuling.net wrote:
> Hi,
>
> Is it possible to create a temporary table in SQLite so that it will only be
> visible to the current session and be destroyed after the session is closed?
> Just like SQL Server
> http://www.codeproject.com/Articles/42553/Quick-Overview-Temporary-Tables-in
> -SQL-Server ?
>
> Thanks
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



[sqlite] Temporary table in SQLite

2016-02-13 Thread Gerry Snyder
Short answer, Yes.

Long answer, have you read the SQLite documents?

Gerry
On Feb 13, 2016 8:13 PM,  wrote:

> Hi,
>
> Is it possible to create a temporary table in SQLite so that it will only
> be
> visible to the current session and be destroyed after the session is
> closed?
> Just like SQL Server
>
> http://www.codeproject.com/Articles/42553/Quick-Overview-Temporary-Tables-in
> -SQL-Server ?
>
> Thanks
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>