Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Bulk copies from view to table

Author  Topic 

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-05-30 : 13:10:55
I have a temporary table that contains 8 columns and about 2 million records. Now this temp table has a few changes that need to be made
ie/
update table
set a.col = b.col
from tablea inner join table b on a.id = b.id

Something simple like that. There are 5 of these in total (5 seperate tables)... So I created a view that does all this combining/updates. Now I need to mass copy all the data from this view into a table (has to do with a 3rd party proggy that needs the table and not a view otherwise I'd just leave it as a view) I want this transfer as fast as possible... No logging preferable. Would a simple insert select be the best for this? or is there a tool that would do this copy faster? The destination table has one extra row that fills with a default value as the data as inserted into it.. Other then that it's identical to the view. I've search through the site and forum for info on this, but haven't found all to much.

Currently looking at bulk inserts or bcp's... but not really getting anywhere with that

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-30 : 13:21:53
You do realize that a view does not exist as a stored set of data values in a database. The rows and columns of data come from tables referenced in the query defining the view and are produced dynamically when the view is referenced.

That being said your data is already in table(s). If you want to duplicate the data into another table, you should be able to select * into destinationtable from view.... this will be non-logged if you have the select into/bulkcopy database option set . . .

<O>
Go to Top of Page

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-05-30 : 13:28:30
Well, I'm using the view just to make it so I don't have to type the inner join statement when I do the select statement in my insert statement...


excuse my inexperience but the select into/bulkcopy database option.. I know how to set it in enterprise manager, is there a way to use t-sql to do it in a storedproc?



Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-30 : 13:34:38
sp_dboption

<O>
Go to Top of Page
   

- Advertisement -