Entry
Database: Microsoft SQLserver: SQL: Table: Operation: Insert: How insert values in table, using SQL?
Dec 22nd, 2003 13:24
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 22 December 2003 - 10:20 pm -------------------
Database: Microsoft SQLserver: SQL: Table: Operation: Insert: How
insert values in table, using SQL?
---
Steps: Overview:
---
1. -Create or open a database
2. -To insert values in the tables,
type the following SQL query:
1. Insert into table 1:
INSERT INTO Person ( Name, PersonKey ) VALUES ( 'John Doe', 1 );
INSERT INTO Person ( Name, PersonKey ) VALUES ( 'Vanessa Beau',
2 );
---
2. Insert into table 2:
INSERT INTO Email ( Emailaddress, PersonKey ) VALUES
( 'john.doe@test.com', 1 );
INSERT INTO Email ( Emailaddress, PersonKey ) VALUES
( 'j.d@aol.com', 1 );
INSERT INTO Email ( Emailaddress, PersonKey ) VALUES
( 'johnny6@yahoo.com', 1 );
INSERT INTO Email ( Emailaddress, PersonKey ) VALUES
( 'vanessa@vendor.com', 2 );
INSERT INTO Email ( Emailaddress, PersonKey ) VALUES
( 'vanessa.beau@yahoo.com', 2 );
INSERT INTO Email ( Emailaddress, PersonKey ) VALUES
( 'v.b.@aol.com', 2 );
3. -If successfully inserted, you should see a response similar
to the following:
(1 row(s) affected)
---
---
in general:
INSERT INTO <Tablename> ( <Columnname1>, <Columnname2>, ...,
<Columnnamelast> ) VALUES ( <valuename1>, <valuename2>, ...,
<valuenamelast> );
---
---
Internet: see also:
---
Database: Microsoft SQL server: SQL: Operation: Overview:Can you give
an overview of SQL operations?
http://www.faqts.com/knowledge_base/view.phtml/aid/27560/fid/147
----------------------------------------------------------------------