Create temporary tables in sybase

General Rules and Information about temporary tables:

  • Temporary tables are created in tmpdb database.
  • To Create temporary table, we must have create table permission in tempb database.
  • To Create temporary table, we can use #(pound) in front of tablename or use tempdb..table_name.
  • If we don’t use # (Pound) symbol or tempdb.., then table is created as permanent table.
  • If we restart ASE server, these tables will be deleted from the server. Which means tables can be accessed in the current session.
  • We cannot create views on these tables.
  • We cannot associate triggers with these tables.

Syntax:
Using pound symbol:

create table #table_name
(colum_name, datatype, column_name2 datatype)

Using tempdb..

create table tempdb..table_name
(colum_name, datatype, column_name2 datatype)

Examples:
Using pound symbol:

create table #test1
(name varchar(10), accountno int)

Using tempdb..

create table tempdb..test2
(name_2 varchar(10), accountno int)

Related Posts

CheapSexCams
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools