all groups > sql server (alternate) > june 2007 >
You're in the

sql server (alternate)

group:

How to make a SQL run longer?


How to make a SQL run longer? Raj
6/27/2007 11:16:26 AM
sql server (alternate):
Hell All,
To reproduce one of our cusotmer's probem, I need to make the SQL to
run for more than a minutes before it returns the result set. I do not
have large amount of data in the database to simulate the dealy.

Is there a way in SQL to cause the delay while returning the result
set

Thanks for the help.

Regards
Raj
Re: How to make a SQL run longer? Raj
6/27/2007 12:47:14 PM
[quoted text, click to view]

Thanks for replying. My challange is that I can pass only one SQL
statement at at time. Is there a function that I use like this:

select a, b, c
from table_a a, table_b where a.cid = b.cid and delay(0:0:1)

Thanks.
Raj
Re: How to make a SQL run longer? Roy Harvey
6/27/2007 2:56:32 PM
WAITFOR will do that.

select getdate()
waitfor delay '00:01:00'
select getdate()

Roy Harvey
Beacon Falls, CT

[quoted text, click to view]
Re: How to make a SQL run longer? Raj
6/27/2007 3:00:31 PM
[quoted text, click to view]

Thank you. I will try this and then update the thread.
Re: How to make a SQL run longer? Raj
6/27/2007 3:05:04 PM
[quoted text, click to view]

Our is an reporting application that can connect to either SQL server
or Oracle, retrieve the data and prsent the data over the web for the
end users. This application has the option to preview the data while
developing the report. Duing the preview, if the query takes more
than
one minute than our application hangs.

I need to reproduce this behaviour but unfortunately does not have
enough
data in my database to create the one minute.

Thanks.
Raj

Re: How to make a SQL run longer? Raj
6/27/2007 3:30:44 PM
[quoted text, click to view]

Thanks. With your suggestion, I was able to do what I want. Here are
the steps I followed

1. Create the following SP in my SQL server.

CREATE PROCEDURE byroyalty1 @percentage int
AS
begin transaction

select au_id from titleauthor(tablockx)

WAITFOR DELAY '0:1:0'
commit transaction
GO

Note the exclusive lock for the table titleauthor

2. Execute this procedure from SQL Query analyzer just before I run my
application. Now my application has to wait longer atleast a minute
before it gets the resultset from the databse.

Thank you for your help.
Regards
Raj
Re: How to make a SQL run longer? Roy Harvey
6/27/2007 3:54:45 PM
[quoted text, click to view]

No, there is no such thing that I know of.

Roy Harvey
Re: How to make a SQL run longer? Erland Sommarskog
6/27/2007 9:33:49 PM
Raj (jkamaraj@gmail.com) writes:
[quoted text, click to view]

Huh? What environment is this?

[quoted text, click to view]

You could write one that calls xp_cmdshell and the uses a wait command
in the shell.



But hopefullly you can also access the database from a regular query
window. In such case you can start a transaction that locks one of the
tables in your query. After a minute you commit/rollback that transaction,
so that the other process is let go.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Re: How to make a SQL run longer? Luuk
6/27/2007 10:05:39 PM

"Raj" <jkamaraj@gmail.com> schreef in bericht
news:1182968186.181731.177720@k29g2000hsd.googlegroups.com...
[quoted text, click to view]

maybe you should tell us WHY you need a delay, because most in the eyes of
most people a SQL-server must be fast, so no DELAY's....

I hink when you do give that information, there might be another way to
solve your problem.

regards,
Luuk

AddThis Social Bookmark Button