Syntax 1:
Create Table # albums (
Artist char (30 ),
Album_name char (50 ),
Media_type INT)
Go
You can also use the following command to manually delete the table.
Drop table # albums
Go
The table can also be automatically deleted when the user exits the SQL-SERVER if you are using this statement in the case of a self-state SQL join, such as the SQL-SERVER OF THE DB-LIBRARY then when the dynamic join is terminated will be automatically deleted.
Syntax 2:
Create Table tempdb .. tablename (field1 datatype,..., fieldn datatype)
The result of creating a temporary table using syntax 2 is the same as that of syntax 1. The name format of the temporary table is the same as that of syntax 1. The difference is that when the user exits SQL or disconnects the table will not be automatically deleted. You must use the drop command to manually delete it in tempdb.
Tip: another way to delete a temporary table created using syntax 2 is to close the SQL-SERVER and restart it, which will delete all tables in tempdb
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.