Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

SQL SERVER copy a table

Thread Tools
 
Search this Thread
 
Old 21 March 2003, 11:31 AM
  #1  
Eagle7
Scooby Regular
Thread Starter
 
Eagle7's Avatar
 
Join Date: Jan 2002
Location: Plymouth
Posts: 960
Likes: 0
Received 0 Likes on 0 Posts
Post

OK DB bods,
I have a table that needs copying into a specific named table regularly.

I have tried using 'select * from t1 into t2' but that does not work if t2 already exists and the user that is running the job doesnt have permission to drop the table.

is there a similarly quick way of copying the contents of one table into another? (apart from a cursor on each line which is very slow)

also is there a way to get certain parts of a stored procedure to run under different permissions, for example to run certain parts of a procedure as SA, to overcome the above.

cheers
Old 21 March 2003, 11:35 AM
  #2  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
Post

Eagle,

Rather than drop and re-create t2 could you not just issue a:
DELETE FROM <t2>
INSERT INTO <t2> (columns) SELECT (columns) from t1

periodically or setup and INSERT trigger on t1 to automatically post records to t2???

Gary
Old 21 March 2003, 11:39 AM
  #3  
Eagle7
Scooby Regular
Thread Starter
 
Eagle7's Avatar
 
Join Date: Jan 2002
Location: Plymouth
Posts: 960
Likes: 0
Received 0 Likes on 0 Posts
Post

cheers

ive managed to sort this now i think.

my permissions were all messed up.

cheers for help

[Edited by Eagle7 - 3/21/2003 11:41:02 AM]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JonMc
Subaru Parts
22
06 February 2016 09:50 PM
IAN WR1
ScoobyNet General
8
28 September 2015 08:14 PM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM
ossett2k2
Engine Management and ECU Remapping
15
23 September 2015 09:11 AM
pimmo2000
Computer & Technology Related
2
21 September 2015 12:04 PM



Quick Reply: SQL SERVER copy a table



All times are GMT +1. The time now is 02:16 PM.