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 |
|
smorty44
Yak Posting Veteran
93 Posts |
Posted - 2007-08-24 : 13:54:09
|
| My cursor never stops, what am I missing?Declare @Ip_FileName nvarchar(255)Declare @Ip_Active char(1)Declare ActiveFile Cursor For Select Ip_FileName, Ip_Active from tln_InputFiles where Ip_Active = 'Y'Open ActiveFileFetch Next From ActiveFile Into @Ip_FileName, @Ip_Active While @@Fetch_Status = 0Begin -- Delete data for this client... Exec('truncate table tri_'+ @Ip_FileName)EndCLOSE ActiveFileDEALLOCATE ActiveFile |
|
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2007-08-24 : 13:59:25
|
| You are missing the FETCH inside the WHILE loopWhile @@Fetch_Status = 0Begin-- Delete data for this client...Exec('truncate table tri_'+ @Ip_FileName)Fetch Next From ActiveFile EndSQL Server Helperhttp://www.sql-server-helper.com |
 |
|
|
smorty44
Yak Posting Veteran
93 Posts |
Posted - 2007-08-24 : 14:17:47
|
| Thank you! |
 |
|
|
|
|
|