Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Help!!! Expand / Collapse
Author
Message
Posted Friday, May 2, 2014 1:19 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 19, 2014 10:11 PM
Points: 6, Visits: 43
I need help in creating a temporary table where I can log the QueryName, StartTime, Endtime, Duration
and run the Select query 100 times with to check the time
Post #1567161
Posted Friday, May 2, 2014 2:00 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:49 PM
Points: 12,946, Visits: 12,355
saifmahatab (5/2/2014)
I need help in creating a temporary table where I can log the QueryName, StartTime, Endtime, Duration
and run the Select query 100 times with to check the time


Pretty sparse on details here but something like this maybe? What are you hoping to accomplish by running the same query 100 times???

create table #MyTable
(
QueryName varchar(100),
StartTime datetime,
EndTime datetime,
Duration int --Do you really need this?
)

go

declare @StartTime datetime = getdate()
declare @EndTime datetime
select YourSelectmentHere
select @EndTime = getdate()

insert #MyTable
select 'YourQueryName', @StartTime, @EndTime, null

go 100





_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1567168
Posted Monday, May 5, 2014 8:42 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 19, 2014 10:11 PM
Points: 6, Visits: 43
Thanks but its not working..I tried I need to create a temp table where it stores the timing of a select query that I have takes time to run
Post #1567758
Posted Tuesday, May 6, 2014 2:57 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:19 AM
Points: 6,721, Visits: 13,832
saifmahatab (5/5/2014)
Thanks but its not working..I tried I need to create a temp table where it stores the timing of a select query that I have takes time to run


Sean's script works for me. Post yours, we'll see what's wrong.


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1567838
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse