Geeks Talk

Prepare for your Next Interview




Copy table without data

This is a discussion on Copy table without data within the SQL forums, part of the Databases category; suppose there are two seperate accounts one account has a table, how can that table be copied without the data being copied into another account...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-28-2008
Junior Member
 
Join Date: Mar 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
rahul.kgupta79 is on a distinguished road
Copy table without data

suppose there are two seperate accounts one account has a table, how can that table be copied without the data being copied into another account
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-28-2008
Contributing Member
 
Join Date: Jul 2007
Posts: 43
Thanks: 1
Thanked 1 Time in 1 Post
priyasp_msit is on a distinguished road
Re: Copy table without data

create table table_name as select * from table_name where 1=2;
Reply With Quote
  #3 (permalink)  
Old 04-25-2008
Junior Member
 
Join Date: Apr 2008
Location: visakhaptnam
Posts: 18
Thanks: 2
Thanked 2 Times in 1 Post
ushalakshmi is on a distinguished road
Re: Copy table without data

select * into [New tab-name] from [old tab-name]

hope this will helpfull.............
Reply With Quote
  #4 (permalink)  
Old 04-25-2008
Contributing Member
 
Join Date: Sep 2007
Location: hyderabad
Posts: 37
Thanks: 5
Thanked 2 Times in 2 Posts
ashalalaxmi2002 is on a distinguished road
Re: Copy table without data

CREATE TABLE table_name2 as select * from table_name1 where 1=0
Reply With Quote
  #5 (permalink)  
Old 04-28-2008
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,432
Thanks: 8
Thanked 126 Times in 113 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: Copy table without data

it is not necessary to give as 1=0 or 1=2 .

In the where clause you can provide any condition which evalutes to false.
Reply With Quote
  #6 (permalink)  
Old 05-03-2008
Junior Member
 
Join Date: May 2008
Location: india
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
majidms7 is on a distinguished road
Re: Copy table without data

we can give negative value also, for this we should have known what records that table contains.
Reply With Quote
  #7 (permalink)  
Old 05-04-2008
Junior Member
 
Join Date: Jan 2008
Location: Mumbai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ec0321 is on a distinguished road
Smile Re: Copy table without data

Quote:
Originally Posted by rahul.kgupta79 View Post
suppose there are two seperate accounts one account has a table, how can that table be copied without the data being copied into another account

Need not worry to much for such issues .have pepsi and enjoy life
Reply With Quote
  #8 (permalink)  
Old 3 Weeks Ago
Junior Member
 
Join Date: Nov 2008
Location: Kanpur
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
krishna1986 is on a distinguished road
Re: Copy table without data

Quote:
Originally Posted by rahul.kgupta79 View Post
suppose there are two seperate accounts one account has a table, how can that table be copied without the data being copied into another account
you can use "paste special" option
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Copy data from word to excel test123test QTP 1 02-27-2008 08:06 AM
Copy Table susarlasireesha Oracle 6 11-05-2007 02:30 AM
How to insert data from one table to an empty table sahanai mishra Oracle Apps 1 08-11-2007 11:45 AM
copy the Table Structure vcyogi SQL Server 3 08-04-2007 02:43 AM
How a java table be brought to data table? dhandhan QTP 0 04-15-2007 06:14 AM


All times are GMT -4. The time now is 12:38 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved