All of Query was successfully tested and running well on Microsoft SQL Server 2008

Kamis, 13 September 2012

sql create table

On SQL Server, to create table use statement as follows:

    FieldName1 DataType,
    FieldName2 DataType,
    FieldName3 DataType,

Example 1:
Create table with name EmployeeList.

    EmployeeId int,
    EmployeeName nvarchar(50),
    EmployeeAddr nvarchar(50),
    EmployeeDept nvarchar(30)

After run on query analyzer, here are
Command(s) completed successfully

Hereafter, copy and paste on query analyzer script below:

Select * from EmployeeList

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

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