Unix Technical Forum

How to make a SQL run longer?

This is a discussion on How to make a SQL run longer? within the SQL Server forums, part of the Microsoft SQL Server category; --> Hell All, To reproduce one of our cusotmer's probem, I need to make the SQL to run for more ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:23 PM
Raj
 
Posts: n/a
Default How to make a SQL run longer?

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:23 PM
Roy Harvey
 
Posts: n/a
Default Re: How to make a SQL run longer?

WAITFOR will do that.

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

Roy Harvey
Beacon Falls, CT

On Wed, 27 Jun 2007 11:16:26 -0700, Raj <jkamaraj@gmail.com> wrote:

>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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:23 PM
Raj
 
Posts: n/a
Default Re: How to make a SQL run longer?

On Jun 27, 11:56 am, Roy Harvey <roy_har...@snet.net> wrote:
> WAITFOR will do that.
>
> select getdate()
> waitfor delay '00:01:00'
> select getdate()
>
> Roy Harvey
> Beacon Falls, CT
>
>
>
> On Wed, 27 Jun 2007 11:16:26 -0700, Raj <jkama...@gmail.com> wrote:
> >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- Hide quoted text -

>
> - Show quoted text -


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 03:23 PM
Roy Harvey
 
Posts: n/a
Default Re: How to make a SQL run longer?

On Wed, 27 Jun 2007 12:47:14 -0700, Raj <jkamaraj@gmail.com> wrote:

>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)


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

Roy Harvey
Beacon Falls, CT
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-01-2008, 03:23 PM
Luuk
 
Posts: n/a
Default Re: How to make a SQL run longer?


"Raj" <jkamaraj@gmail.com> schreef in bericht
news:1182968186.181731.177720@k29g2000hsd.googlegr oups.com...
> 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
>


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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-01-2008, 03:23 PM
Erland Sommarskog
 
Posts: n/a
Default Re: How to make a SQL run longer?

Raj (jkamaraj@gmail.com) writes:
> Thanks for replying. My challange is that I can pass only one SQL
> statement at at time.


Huh? What environment is this?

> 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)


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/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-01-2008, 03:23 PM
Raj
 
Posts: n/a
Default Re: How to make a SQL run longer?

On Jun 27, 2:33 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> Raj (jkama...@gmail.com) writes:
> > Thanks for replying. My challange is that I can pass only one SQL
> > statement at at time.

>
> Huh? What environment is this?
>
> > 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)

>
> 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, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


Thank you. I will try this and then update the thread.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-01-2008, 03:23 PM
Raj
 
Posts: n/a
Default Re: How to make a SQL run longer?

On Jun 27, 1:05 pm, "Luuk" <l...@invalid.lan> wrote:
> "Raj" <jkama...@gmail.com> schreef in berichtnews:1182968186.181731.177720@k29g2000hsd.g ooglegroups.com...
>
> > 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

>
> 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


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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-01-2008, 03:23 PM
Raj
 
Posts: n/a
Default Re: How to make a SQL run longer?

On Jun 27, 2:33 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> Raj (jkama...@gmail.com) writes:
> > Thanks for replying. My challange is that I can pass only one SQL
> > statement at at time.

>
> Huh? What environment is this?
>
> > 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)

>
> 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, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com