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 |
|
markth
Starting Member
1 Post |
Posted - 2005-07-23 : 21:58:04
|
| I use this store procedure My table have thirty thousands recordBut running more than 30 hours..any better method ? thanks a lot ============================================================declare @No varchar(12)Declare A_cur Cursor forSelect No from CUSTNo order by NoOPEN A_curFETCH NEXT FROM A_cur INTO @NoWHILE (@@FETCH_STATUS=0)BEGINselect @A1=Min(CUSTVALUE) from CUSTVALUE where No=@No SELECT @A2= ID FROM (select ID AS ID from CUSTDATA1 where No=@No union select ID AS ID from CUSTDATA2 where No=@No )etc......Insert CUSTdetail(detail)select @A1+@A2+@A3+@A4+@A5+... FETCH NEXT FROM A_cur INTO @NoEND |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2005-07-24 : 00:58:12
|
| First, get rid of the cursor. Second, post some DDL for the tables you are referencing, make sure to include the DDL for the indexes you have.-ec |
 |
|
|
|
|
|