01_Sintaks SQL Server 2000.pdf - Google Drive

0 downloads 131 Views 528KB Size Report
Download. Connect more apps... Try one of the apps below to open or edit this item. 01_Sintaks SQL Server 2000.pdf. 01_S
SINTAKS SQL SERVER 2000 ( 1 ) 1. CREATE TABLE with one column # : Temporary Table ----- start ---USE PUBS GO CREATE TABLE #MyTempTable ( cola INT PRIMARY KEY ) GO SELECT * FROM #MyTempTable GO ----- end ---Results :

2. INSERT INTO with one column ----- start ---USE PUBS GO INSERT INTO #MyTempTable VALUES (1) INSERT INTO #MyTempTable VALUES (2) INSERT INTO #MyTempTable VALUES (3) INSERT INTO #MyTempTable VALUES (4) INSERT INTO #MyTempTable VALUES (5) INSERT INTO #MyTempTable VALUES (6) GO SELECT * FROM #MyTempTable GO ----- end ----

Reference to : 1. MSDN Library Help of SQL Server 2000 2. www.w3schools.com/sql/

1

Results :

3. UPDATE one record ----- start ---USE PUBS GO UPDATE #MyTempTable SET cola = WHERE cola = GO

10 1

SELECT * FROM #MyTempTable GO ----- end ---Results :

Reference to : 1. MSDN Library Help of SQL Server 2000 2. www.w3schools.com/sql/

2

4. DELETE one record The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row. ----- start ---USE PUBS GO DELETE #MyTempTable WHERE cola = GO

10

SELECT * FROM #MyTempTable GO ----- end ---Results :

5. DELETE all record ----- start ---USE PUBS GO DELETE #MyTempTable GO SELECT * FROM #MyTempTable GO ----- end ---Results :

Reference to : 1. MSDN Library Help of SQL Server 2000 2. www.w3schools.com/sql/

3

6. TRUNCATE TABLE TRUNCATE TABLE removes the data by deallocating the data pages used to store the table's data, and only the page deallocations are recorded in the transaction log. ----- start ---USE PUBS GO TRUNCATE TABLE #MyTempTable GO SELECT * FROM #MyTempTable GO ----- end ---Results :

7. DROP TABLE ----- start ---USE PUBS GO DROP TABLE #MyTempTable GO SELECT * FROM #MyTempTable GO ----- end ---Results :

Reference to : 1. MSDN Library Help of SQL Server 2000 2. www.w3schools.com/sql/

4