Sleep For N Seconds

Jul 20, 2005

Hi

I am trying to use the WAITFOR function to make each loop in a cursor
occur every 4 seconds until the curdb is empty

the prtocedure is as follows

---------------- start
create procedure q_additionalrabatt
@additionalrabatt float,
@ordernr int

AS

declare @ordradnr int

declare curdb cursor for select ordernr, ordradnr from orp where
ordernr = @ordernr
for read only

open curdb

fetch curdb into @ordernr, @ordradnr

while @@fetch_status = 0
begin

updateorp
setorp.rabatt1 = (orp.rabatt1 + @additionalrabatt)
whereorp.ordernr = @ordernr and
orp.ordradnr = @ordradnr

fetch curdb into @ordernr, @ordradnr

end

close curdb
deallocate curdb

------------------- end

I need to make sure, that before it fetches the next row it waits 4
seconds before executing the next loop.

Matt

View 1 Replies


ADVERTISEMENT

Convert Seconds To Hours:minutes:seconds

Jul 23, 2005

Hi all.If I've got a query which has a field with seconds in it... how will I usethe Convert function to get my field converted to the format: HH:MM:SS ?The field with the seconds in is called: "Diff"Thanks alotRudi

View 2 Replies View Related

Why Query Takes 0 Seconds And Stored Procedure Takes 16 Seconds Sql Server 2000

Sep 21, 2007



I have a Stored Procedure that has a query in it and it take 0 second and then a stored procedure that takes 16 seconds. From what I can tell they shoul be the same.

It doesn't recompile when i run the stored procedure, I checked that.

View 8 Replies View Related

Does Sql Server Has BIF Like Sleep()?

Apr 1, 2004

Dear all:
Does sql server has BIF like vb sleep()?
I want to use this kind of function to balance the sql server loading,
or do you have better way to implement this task?

thanks for your kindly assistance

regards,

Stanley Huang

View 2 Replies View Related

VBscript Sleep

Apr 28, 2004

im writing a DTS package and i have am using vbscript to check if a file exists on an ftp server.

I can't figure out how to make my process sleep b/t checks on if the file exists.

in vb u can just

Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

but i cant seem to find a counterpart in vbscript.

thanks in advance,
pete

View 8 Replies View Related

Website Seems To 'sleep' When No One Accesses It....

Jan 24, 2007

Hi,
Im currently running a website in conjuction with MSSQL Express. However at the moment the website/database seems to 'sleep' when no-one is using it, then there are huge dealays accessing the data while the database/website kicks in again. I tried to google this but truthfully i don't know what i am looking for. Does anyone have any ideas? Or whether this problem is Database or website driven? I thought there might be a control in the web.config but i haven't found a solution as yet!
Thanks
 Daniel

View 1 Replies View Related

Can You Use 'Pause' Or 'Sleep' In SQL Query?

Jan 4, 2008

 Can you use 'Pause' or 'Sleep' in SQL query?

View 3 Replies View Related

Reporting Service Seems To Go To Sleep After A While...

Sep 11, 2007


My reporting server seems to go to sleep after some time of non-use. This is affecting the users who create reports at the start of the day. A report that takes 1 second to generate takes 11 seconds on first hit in the morning. After the initial "wake up" call, the report server generates the reports normally without any delay. Can I keep it awake the whole time? Is there a setting somewhere?

View 13 Replies View Related

Need Help Lost A Lot Of Sleep--Percentage??????

Oct 17, 2007



I created a report using the wizard. Every thing works fine. but in one section the report returns the value of a subtotal just fine. Now I'm trying to get it to do a %(percent) using the subtotal and it keeps returning a percentage using the grand total value of what I'm adding.

i have a
group total in the group <this fine> this is want i need look down |
V
catalog %
-------------------------------------------
person total to the group<want a % based on the group>
activity total based on the total of the person activity



can any help

View 2 Replies View Related

SSRS 2005 Goes To Sleep!

Jul 17, 2006

Has anyone figured out why it takes about 30-60 seconds to load a report or even get the login webpage in SSRS2005?? This seems to happen in 2 situations. One, the server has just started up and its the first request for a report or the SSRS webpage. Two, no one has requested a report or a SSRS webpage for a while (say 30min, maybe less). Its like part of SSRS has gone to sleep. Is there anyway to keep this from happening??

View 4 Replies View Related

Putting A Stored Proc To Sleep.

Jun 2, 2004

is there a way to pause a stored proc for x amount of time and then continue. I rather not go through a loop x number of times if I had to.

thanks,
DMW

View 3 Replies View Related

Wscript.sleep Doesn't Work In SQL?

Aug 22, 2007

I setup a maintenance plan in SQL and added some vbscript codes. One line is just wscript.sleep 10000. When I tried to run the job, I received error description: variable is undefined: 'wscript'

What's up with SQL?

View 1 Replies View Related

Problem With Sleep Function In SSIS

Jun 22, 2006

Hi,

I have a script task in SSIS which uses a sleep command. sleep(600000) which waits for 10 minutes. This works fine when i execute the package through GUI. But when i execute the same with Commandline, it does not work. Is there some thing which I have not set. I have also tried the Windows API call for sleep still it behaves the same way.



Any help??



Thanks in advance

Srividya

View 3 Replies View Related

Report Server Goes To Sleep....zzzzzzz

Jul 21, 2006

The known issue about the report server going to sleep after being idle for a while is causing me a problem. I have set up a dummy sibscription to create and email a report every hour and also have set the IIS setting on the application pool the RS uses (shut down worker process after being idle for x mins, I have set this to 860!).

But the report server still goes to sleep and it can take up to 60 seconds for a report to start up.

What else can I set to reduce this problem?

View 5 Replies View Related

SPID Goes To SLEEP Every Time I Run A DBCC Command

May 14, 2008

So every time i run a DBCC command like DBCC SHOW_STATISTICS and DBCC INDEXFRAG, the query executes and goes on for ever. When i do a sp_who2 i notice that my DBCC SPID goes to sleep mode with high CPUTime and High DiskIO's. i also noticed that my server has no activity, no inserts, no updates and no select statements running by other users. Why cant i run a DBCC command?

You thoughts and suggestions are highly appreciated!
Thanks in advance

Lana

THE LADDERS (The Most $100k+ Jobs.)
www.TheLadders.com

View 3 Replies View Related

How To Repeat Delete Records And Sleep Awhile In T-SQL

Feb 14, 2008

Hi:

I have one table in which there are almost 800,000 records, and I tried to delete them by SQL stored-procedure in which executing SQL like this: "delete from tablename where date='YYYYMMDD'", once I started this procedure, I noticed SQL server will take most of CPU resources in a short period, but that's not acceptable. and there are some other useful records in this table, we can't use Drop Table.
So my question is "can we delete 1000 records and then sleep awhile, and repeat until all these records are deleted !"

Any refernece will be appreciated, thanks!

View 5 Replies View Related

Multiple Table Joins Makes Query Go To Sleep

Jul 23, 2005

Hello All & Thanks in advance for your help!Background:1) tblT_Documents is the primary parent transaction table that has 10fields and about 250,000 rows2) There are 9 child tables with each having 3 fields each, their ownPK; the FK back to the parent table; and the unique data for thattable. There is a one to many relation between the parent and each ofthe 9 child rows. Each child table has between 100,000 and 300,000rows.3) There are indexes on every field of the child tables (though Idon't believe that they are helping in this situation)4) The client needs to be presented a view that has 5 of the mainfields from the parent table, along with any and all correspondingdata from the child tables.5) The client will select this view by doing some pattern-matchingsearch on one of the child records' detail (e.g. field-name LIKE%search-item% - so much for the indexes...)Problem:When I do the simple join of just the parent with one of the children,the search works *fairly* well and returns the five parent fields andthe corresponding matching child field.However, as soon as I add any one of the other child records to simplydisplay it's unique data along with the previously obtained results,the resulting query hangs.Is the overall structure of the tables not conducive to this kind ofquery? Is this a situation where de-normalization will be required toobtain the desired results? Or, more hopefully, am I just an idiotand there is some simpler solution to this problem?!Thanks again for your assistance!- Ed

View 9 Replies View Related

Seconds

Jun 10, 2008

I am really confused and I can’t concentrate. Please help me with this easy question:
I have a field which contains seconds for example 128460 I need to have how much hours is that in my Query.
Please Help me.


Sep

View 6 Replies View Related

Seconds To HH:MM:SS

Mar 6, 2007

I'm using a stored procedure that outputs a field of duration in seconds... I'm limited in that I cannot edit the stored procedure to alter the output but I need to convert this duration to hh:mm:ss. Is there a way to do this using the expression editor in RS 2000?



Many thanks.

View 3 Replies View Related

Convert HH:MM:SS Into Seconds

Nov 2, 2007

Hi,

I have an user input variable called @stop_time which takes input in the format of HH:MM:SS.

I need to convert it into seconds only.

declare @start_time datetime
set @start_time ='02:15:00'


How can I do that?

Can anyone help please?

View 1 Replies View Related

How To Convert Seconds To DD:HH:MM:SS

Sep 21, 2005

Hello every one I have a column in my table which stores seconds.
I want to convert the value into Days:Hours:Minutes:Secons(DD:HH:MM:SS) format.
Can anybody please tell me how to do that.

The value of seconds wil be large (eg. 16798563,..and so on) SO how to I convert this value to the format I need.

URGENT PLZ
Regards
Mohsin Iqbal

View 1 Replies View Related

Dts Package To Run Every 10 Seconds

Oct 6, 2006

Does anyone know if you can shedule a dts package to run every 10 seconds ?
I can see that you can create a job but this only has the option for the earliest run set to 1 minute.

Any advice

Ian

View 4 Replies View Related

Got Seconds But Need Minutes

Apr 16, 2004

I have a result that comes out in number of seconds, but need to see it converted to minutes and hours and seconds. Is there a convert function that would do this?

Thanks,
Dan

View 3 Replies View Related

Convert Seconds To Hh:mm:ss

Apr 28, 2008

How to Convert Seconds (i.e., 114) to hh:mm:ss format,

is there any way.. i've a column (DURATION) which is recorded in Seconds
AND USER wants to see the seconds in hh:mm:ss 00:14:28

pls.help

thanks

View 2 Replies View Related

Convert Seconds To Hh:mm:ss

Jun 19, 2008

Hi, I have a field with seconds in it, and I need to convert this so that it shows in the format hh:mm:ss. Is there an easy way to do this?

Thanks in advance,

Ben

View 3 Replies View Related

Adding Seconds

Jul 25, 2006

Hi,

i have a huge table.One of the columns of the table is fTime, which is datetime data type. But there is NO seconds in the fTime column. What i wanna do is to add seconds to this column according to the example below;

2006-07-24 18:10:00----> 2006-07-24 18:10:00
2006-07-24 18:10:00----> 2006-07-24 18:10:59

2006-07-25 10:20:00----> 2006-07-25 10:20:00
2006-07-25 10:20:00----> 2006-07-25 10:20:15
2006-07-25 10:20:00----> 2006-07-25 10:20:30
2006-07-25 10:20:00----> 2006-07-25 10:20:45
2006-07-25 10:20:00----> 2006-07-25 10:20:59

2006-07-25 12:00:00----> 2006-07-25 12:00:00
2006-07-25 12:00:00----> 2006-07-25 12:00:30
2006-07-25 12:00:00----> 2006-07-25 12:00:59


Shortly, as you can understand from above, the first second should be 00, the last second should be 59 and the rest will be calculated by, 60/count of same fTime rows - except the last row. There is one important thing to consider, which is the speed of the statements which include those calculations because of the huge number of rows i my table.

thanks

View 18 Replies View Related

Convert HH:MM:SS To Seconds?

Sep 24, 2007

Hello,

How would one convert HH:MM:SS to Seconds?

Thanks in advance!

--Phb

--PhB

View 1 Replies View Related

Convert HH:MM:SS Into Seconds

Nov 2, 2007

Hi,

I have an user input variable called @stop_time which takes input in the format of HH:MM:SS.

I need to convert it into seconds only.

declare @start_time datetime
set @start_time ='02:15:00'


How can I do that?

Can anyone help please?

View 1 Replies View Related

How Can I Use Format As HH:MM:SS From Seconds Within The SQL Query

Nov 8, 2007

I have the following SQL query where i want thease to be populate to GridView, but the Duration field is in Second format, I want it would be in HH:MM:SS format.
cmd = "select subscriber_id as Subscriber_no,,amount,duration from MyTable" ;
Please help me how to format this within the Query to display in GridView.

View 3 Replies View Related

Convert Seconds To DateTime

Jan 28, 2008

I have values in seconds (integers) in a database column and I want to convert those values to datetime. For example: 102 into 1:42(60 seconds = 1 minute + 42 seconds = 1:42), 150 into 2:30, etc.

I've been working for hours today on this, but haven't been able to come up with a solution.

View 4 Replies View Related

Help.. Simple Query Took 20+ Seconds

Mar 26, 2004

Hi all,

can someone give me some advise on how to troubleshoot this.... thanks.

Here is the situation:

We have a server running nicely for the past 1 years. And just yesterday, things started to acting very slow.
A simple query that will return one row:

"select * from product where itemno = 1234 and visible =1"

will take 20 second sometime 30! The weird thing is.. it only happens intermittently. The table also only contain 4000 rows. so its not even a big table. I am not sure if this is caused by lack of memory or what (256mb ram, p4 1ghz on this server).

The system cpu usage % avg around 3-8%. but when that weird behavior started. All the other queries will wait for it to finished and then burst the cpu usage up to 100%. Afterward, it will level off and then the cycle repeat again.

I'm just hoping if anyone can give me a few pointers as of where to troubleshoot. I've tried rebuild the index on that table but it didn't help. This weird behavior not only happen on this particular table, but also on different db within the same server. (note: they are small dbs only)

p.s. here is the site that is running on this db, you'll see this weird delay after a few click on the pages.
http://www.animepot.com

Thanks you for your time,
Derick

forgot to mentioned, the sql server is 7.0

View 2 Replies View Related

T-SQL (SS2K8) :: Convert Value To Seconds?

Jun 3, 2014

I want to calculate total sum of column.

I have a table with many values of column:

declare @time table
(times nvarchar(255))
INSERT INTO @time (times)
Select ('05:01')
UNION ALL
Select ('00:01')
UNION ALL
Select ('170:01')
UNION ALL
Select ('2543:01')
Select * from @time

How can I get seconds value for every row?

05:01 - 301
00:01 - 1
170:01 - 10201

P.s. Finally I use - Select convert(char,dateadd(second,152581,60),108) as sumtime

View 2 Replies View Related

Convert Seconds To Minutes

Oct 28, 2005

I need to convert 300.876 to 5:00.876 in classic asp. Can anyone help?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved