faqts : Computers : Databases : Microsoft SQL Server

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

6 of 12 people (50%) 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 
( '[email protected]', 1 );
      INSERT INTO Email ( Emailaddress, PersonKey ) VALUES 
( '[email protected]', 1 );
      INSERT INTO Email ( Emailaddress, PersonKey ) VALUES 
( '[email protected]', 1 );
      INSERT INTO Email ( Emailaddress, PersonKey ) VALUES 
( '[email protected]', 2 );
      INSERT INTO Email ( Emailaddress, PersonKey ) VALUES 
( 'vanessa.bea[email protected]', 2 );
      INSERT INTO Email ( Emailaddress, PersonKey ) VALUES 
( '[email protected]', 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
----------------------------------------------------------------------