Faqts : Business : Databases : Microsoft SQL Server

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 13 people (54%) answered Yes
Recently 5 of 10 people (50%) answered Yes

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

----------------------------------------------------------------------