On SQL Server, to create table use statement as follows:
CREATE TABLE TableName
(
FieldName1 DataType,
FieldName2 DataType,
FieldName3 DataType,
...
)
Example 1:
Create table with name EmployeeList.
CREATE TABLE EmployeeList
(
EmployeeId int,
EmployeeName nvarchar(50),
EmployeeAddr nvarchar(50),
EmployeeDept nvarchar(30)
)
After run on query analyzer, here are
#Results:
Command(s) completed successfully
Hereafter, copy and paste on query analyzer script below:
Select * from EmployeeList
#Results:
EmployeeId EmployeeName EmployeeAddr EmployeeDept
This Table is empty.
We can be fill EmployeeList table with data, use INSERT INTO SQL SERVER Statement.
insert into EmployeeList (EmployeeId,EmployeeName,EmployeeAddr,EmployeeDept) values ('11111','John Nuxer','Jl Raya Bekasi Km 28','MIS Dept')
Yes, now 1 data inserted to EmployeeList table.
See with run this query
Select * from EmployeeList
#Results:
EmployeeId EmployeeName EmployeeAddr EmployeeDept
11111 John Nuxer Jl Raya Bekasi Km 28 MIS Dept
How to create table with another way? or Is there any way auto create table on SQL Server?
Yes, here.
Tidak ada komentar:
Posting Komentar