How to Become Author of TechFusion || write your suggestion and idea on comment box, we try to implement it.


Create a Table from Another table :-

            To create copy of existing table use the following syntax

select */<Columnn List> into  <New Table Name> From <Old Table Name>

eg.
folowing  table create the copy of the table student form with the name stud

select * into tbl_copy from student


insert table with only specefic columns  or Conditions.

select  *  into tbl_Copy1 from tbl_Emp where FName='abhijit'


while creating a table from another table if you dont

to copy the data then specify a condition on the where clause which will be false


select * into student2 from Student where 1=0

Note
       While creating  a table from another table constraints and  indexes available on existing table will not be copy to new table

------------------------------------------------------------
Inserting Row from one table  to Another Table:-
        
You can insert rows from one tables to another provided those tables have columns with same datatype and for this use the following syntax of insert statement.


insert into <Table Name> <Select Statment>

eg:


insert tbl_Copy(StudentId,FirstName ,LastName )select StudentId,FirstName,LastName from Student
12 Jun 2014

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

Rate me

Free Rating Code
 
Top