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.
| Author |
Topic |
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2011-07-06 : 02:05:26
|
| Hello All,I am using cursor, in that all records i am storing in temparory table. Now i want to push this tables data into database table.Is there any Bulkcopy method in SQL server.Thanks and Regard'sHarish Patil |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2011-07-06 : 02:38:41
|
| Some questions:- Why are you using a cursor?- Why are you using a temporary table?Yes there are bulk copy methods in sql server but can you instead give a little more detail about what you are doing? From what you are saying I get the feeling that there are far more efficient ways of doing the stuff your trying to do.- LumbagoMy blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/ |
 |
|
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2011-07-06 : 03:03:19
|
| Hello Friend,I am fetching record through cusrsor and doing some operation on that and saving one by one records. These record more than 3,00,000.So in cursor it hits so many time, so performance is less. So i thought first we can store all records in temparory table and then will insert directly into database. So many be performance will increase. So please tell me how to use bulkcopy in sql server.thnksharish |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2011-07-06 : 03:26:33
|
| Sounds like a terrible idea to process 300k rows in a cursor, insert them into a temp-table and then move them to a "real" table but if you insist you can do like this:INSERT INTO MyRealTable (Col1, Col2)SELECT Col1, Col2FROM #MyTempTableBulk copy is basically used for importng/exporting data to/from the database server and not within sql server itself, read more about the concepts here: http://msdn.microsoft.com/en-us/library/ms190625.aspx- LumbagoMy blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/ |
 |
|
|
hspatil31
Posting Yak Master
182 Posts |
Posted - 2011-07-06 : 03:45:03
|
| Hi,Can you please tell anyother idea instead of this ?thnksHarish |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2011-07-06 : 04:38:34
|
| Show us the cursor and we'll see what's possible- LumbagoMy blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/ |
 |
|
|
|
|
|