2012年3月29日星期四
Fluctuate in DB Performance Statistics
I have noticed that the DB performance statistics is not
stable as it will rise at certain time dramatically.
I have checked that there isn't any job at that time.
E.g. Server\memory/pages , Current disk queue length,
processor time
Can any one suggest on any cause this?
Thanks.most database applications today consists of a mix of
simple transactions and complex queries that process a lot
of data. this includes reports or other sophisticated
features.
if you have for example 100 concurrent users running the
simple transactions, you might see a stable load on the
server,
however, anytime someone hits one of the complex queries,
you might see cpu spike.
this is why many people recommend separating OLTP and DSS
applications. there is no such thing as a machine powerful
enough to handle both functions on one server.
the OLTP server depends on fast response times, meaning it
should operate at low cpu loading.
the DSS app is supposed to run with cpu pegged, if not,
then you should be running more DSS queries to it, you
bought the hardware, you may as well use it.
>--Original Message--
>Dear All,
>I have noticed that the DB performance statistics is not
>stable as it will rise at certain time dramatically.
>I have checked that there isn't any job at that time.
>E.g. Server\memory/pages , Current disk queue length,
>processor time
>Can any one suggest on any cause this?
>Thanks.
>.
>|||Run profiler at that time to see if it is any TSQL commands causing this. Also, it can be the
checkpoint process.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Jackty" <anonymous@.discussions.microsoft.com> wrote in message
news:022d01c3ad86$140683a0$a601280a@.phx.gbl...
> Dear All,
> I have noticed that the DB performance statistics is not
> stable as it will rise at certain time dramatically.
> I have checked that there isn't any job at that time.
> E.g. Server\memory/pages , Current disk queue length,
> processor time
> Can any one suggest on any cause this?
> Thanks.
Flow Control in SSIS
I am having a hard time with what appears to be something simple. I want to import an excel spreadsheet into a table on a daily basis from a command line. I created a package from the Import Wizzard in the SQL Management Studio and saved it. Since I want a clean table each day, my process needs to be create a temp table, import from the Excel file into the temp table. If that is successful, delete the original table and rename the temp table the original name. The point of this process is to provide for a fail-safe if there is some unforseen problem downloading the data on a particular day.
When I run the package, the first thing it does is delete the original table. I know this because the process shows the time that it finished is before anything else has started or finished. The time shown for the completion of the data flow task is about 2 minutes after that time.
This is maddening!!! The one thing I do not want to happen I can not seem to prevent. I have my control flow set on success. Why does it do this?
Are you using precedence constraints? You should have a flow like:
Create temp table(Execute SQL task) -- load temp table (Dataflow) --> delete orig. table & rename temp (Execute SQL Task)
The precedence constraint should be set upon success of the previous task
|||Thanks for the reply. I was using contraints and what you descibe is how I put it in my original message. However, after a good night's sleep I see that in my package I the drop table task comes after the table is renamed, rather than before. It appears SSIS was trying its best to complete all those items the best it could.
After putting all in correct order, the package ran as it should.
Flow Control in SSIS
I am having a hard time with what appears to be something simple. I want to import an excel spreadsheet into a table on a daily basis from a command line. I created a package from the Import Wizzard in the SQL Management Studio and saved it. Since I want a clean table each day, my process needs to be create a temp table, import from the Excel file into the temp table. If that is successful, delete the original table and rename the temp table the original name. The point of this process is to provide for a fail-safe if there is some unforseen problem downloading the data on a particular day.
When I run the package, the first thing it does is delete the original table. I know this because the process shows the time that it finished is before anything else has started or finished. The time shown for the completion of the data flow task is about 2 minutes after that time.
This is maddening!!! The one thing I do not want to happen I can not seem to prevent. I have my control flow set on success. Why does it do this?
Are you using precedence constraints? You should have a flow like:
Create temp table(Execute SQL task) -- load temp table (Dataflow) --> delete orig. table & rename temp (Execute SQL Task)
The precedence constraint should be set upon success of the previous task
|||Thanks for the reply. I was using contraints and what you descibe is how I put it in my original message. However, after a good night's sleep I see that in my package I the drop table task comes after the table is renamed, rather than before. It appears SSIS was trying its best to complete all those items the best it could.
After putting all in correct order, the package ran as it should.
sqlfloat vs decimal - computation time
using decimals. Is this true? What is the role of the floating-point
processor in these computations?
JasonCP Developer (steved@.newsgroup.nospam) writes:
> I have heard that using floats in calculated fields are much faster than
> using decimals. Is this true? What is the role of the floating-point
> processor in these computations?
Instead of asking again, why not researching the responses to your post
from Wednesday?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Erland et al,
I apologize. I meant to follow-up my earlier post and I realize that it was
both unclear and unnecessary to repost. I have found what I was looking for.
Thank you very much for your help.
CP Developer
"Erland Sommarskog" wrote:
> CP Developer (steved@.newsgroup.nospam) writes:
> Instead of asking again, why not researching the responses to your post
> from Wednesday?
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx
>
2012年3月9日星期五
Fix dependencies during or after renaming
up with from time to time. SQL Server allows us to rename objects via a
system stored procedure (I usually use an ADP front-end that presumably calls
the same procedure), but after the rename, I find singnificant strangeness.
For instance, triggers are still connected to the tables, but the trigger text
still refers to the old table name. Views and stored procedures dependent on
the table are broken, and are not fixed by even by restarting the server,
though I thought the cached plans were supposed to be dumped on shut-down,
then recreated on demand later.
Is there some tool or technique to rename a table and automatically detect and
properly drop/rebuild dependent triggers, views, stored procedures,
relationships, and anything else I'm not thinking of?
Oh yeah, and there are extended properties to deal with as well, but I guess
that's intractible unless we know what client build them (e.g. Access ADP),
and what it expects to be recorded there, but I suppose it would be nice to
just dump them rather than leave them there possibly corrupted from a client's
persective.Steve Jorgensen wrote:
> The previous post regarding dependencies reminded me of another bugger I come
> up with from time to time. SQL Server allows us to rename objects via a
> system stored procedure (I usually use an ADP front-end that presumably calls
> the same procedure), but after the rename, I find singnificant strangeness.
> For instance, triggers are still connected to the tables, but the trigger text
> still refers to the old table name. Views and stored procedures dependent on
> the table are broken, and are not fixed by even by restarting the server,
> though I thought the cached plans were supposed to be dumped on shut-down,
> then recreated on demand later.
> Is there some tool or technique to rename a table and automatically detect and
> properly drop/rebuild dependent triggers, views, stored procedures,
> relationships, and anything else I'm not thinking of?
> Oh yeah, and there are extended properties to deal with as well, but I guess
> that's intractible unless we know what client build them (e.g. Access ADP),
> and what it expects to be recorded there, but I suppose it would be nice to
> just dump them rather than leave them there possibly corrupted from a client's
> persective.
One thing I know about views, if you rename a view, you best double
click it in EM and rename it in the create statement as well otherwise
it will get renamed back to the old name if ever you script it.
(checks his 4 views, nope, that's not why that happened).|||On Fri, 23 Jan 2004 11:01:27 GMT, Steve Jorgensen <nospam@.nospam.nospam>
wrote:
>The previous post regarding dependencies reminded me of another bugger I come
>up with from time to time. SQL Server allows us to rename objects via a
>system stored procedure (I usually use an ADP front-end that presumably calls
>the same procedure), but after the rename, I find singnificant strangeness.
>For instance, triggers are still connected to the tables, but the trigger text
>still refers to the old table name. Views and stored procedures dependent on
>the table are broken, and are not fixed by even by restarting the server,
>though I thought the cached plans were supposed to be dumped on shut-down,
>then recreated on demand later.
Oh yeah, I guess the views and procedures don't get the table names updated in
the code, so that one's obvious (though I'd still like an automated way to fix
it). What -was- confusing about that was why renaming a -column- causes
problems for stored procedures and views, even after a restart, even if the
procedure or view is uing an asterisk in the select and not directly
referencing the column in question.|||Steve Jorgensen (nospam@.nospam.nospam) writes:
> Oh yeah, I guess the views and procedures don't get the table names
> updated in the code, so that one's obvious (though I'd still like an
> automated way to fix it). What -was- confusing about that was why
> renaming a -column- causes problems for stored procedures and views,
> even after a restart, even if the procedure or view is uing an asterisk
> in the select and not directly referencing the column in question.
Hm, I wrote this procedure:
create proc test_sp as select * from test
Which I subsequently executed. And I found that test had two columns
'mystring' and 'col'.
Then I ran:
sp_rename 'test.mystring', hisstring, 'column'
Without restarting the server, I successfully ran the procedure, and
the column was called 'hisstring'. I then created:
create view test_view as select * from test
And then:
sp_rename 'test.hisstring', herstring, 'column'
I was able to select from the view after this. However in the view
the column was still named 'hisstring'. This is because SQL Server
stores the name of the columns in the view in the system tables. This
can be remedied with:
exec sp_refreshview test_view
Finally, I would like to point out that I, and many with me, find it
to be bad coding practice to use SELECT * in production code.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Steve Jorgensen (nospam@.nospam.nospam) writes:
> The previous post regarding dependencies reminded me of another bugger I
> come up with from time to time. SQL Server allows us to rename objects
> via a system stored procedure (I usually use an ADP front-end that
> presumably calls the same procedure), but after the rename, I find
> singnificant strangeness.
> For instance, triggers are still connected to the tables, but the
> trigger text still refers to the old table name. Views and stored
> procedures dependent on the table are broken, and are not fixed by even
> by restarting the server, though I thought the cached plans were
> supposed to be dumped on shut-down, then recreated on demand later.
> Is there some tool or technique to rename a table and automatically
> detect and properly drop/rebuild dependent triggers, views, stored
> procedures, relationships, and anything else I'm not thinking of?
The major enterprise data-modelling tools offers such features.
If you have your code under version-control - and this is what you should -
you could run some search/replace tool, provided that the old column
name is significant enough.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
FiscalWeekOfQuarter missing
http://msdn2.microsoft.com/en-US/library/ms175662.aspx#time_dimension_attribute_types
Anyone know how I can add it? Thanks.
Can you describe the steps you took to build the dimension? I just ran through the dimension wizard, building a server-based time dimension and an attribute of type "FiscalWeekOfQuarter" was created by the wizard. I also looked at an existing time dimension I had based on a dimension table and I can select "FiscalWeekOfQuarter" as the Type for an existing dimension attribute...
Dave Fackler
FiscalWeekOfQuarter missing
http://msdn2.microsoft.com/en-US/library/ms175662.aspx#time_dimension_attribute_types
Anyone know how I can add it? Thanks.
Can you describe the steps you took to build the dimension? I just ran through the dimension wizard, building a server-based time dimension and an attribute of type "FiscalWeekOfQuarter" was created by the wizard. I also looked at an existing time dimension I had based on a dimension table and I can select "FiscalWeekOfQuarter" as the Type for an existing dimension attribute...
Dave Fackler
2012年3月7日星期三
First Timer Having an Insert Problem
I am currently writing a custom DTS package using an ActiveX script. This is my first time writing an ActiveX script and using the VBscripting language.
What I need to do is take data from three existing MS SQL Server 2k tables and import it into a single new table after serveral numerical data manipulations.
The specific problem I am having is that when I insert my recorsets into the new table several of the records are out of their sequential order. I am confused because if I cut down on the amount of data I insert, either in the number of rows and/or number of columns, I have no problem with my insert, but when I insert all the data I need things get out of order and swap places. I am inserting using what I think is called a connection/execute command with TSQL commands, and from what I have read this is the most efficient way to go about it.
I have approximately 4800 rows to insert with 6 columns, but my program seems to error with I try to insert in excess of 4100 rows.
Does anyone have any ideas? I was told that it might have something to do with a buffer, but I have not been able to find any helpful documentation. I have included the code for my insert loop.
Thank you in Advance!
-TRoche
do until GPSxRecord.EOF
GPSx = GPSxRecord.Fields ("GPS_x").value
tx = GPSxRecord.Fields ("tx").value
GPSy = GPSyRecord.Fields ("GPS_y").value
ty = GPSyRecord.Fields ("ty").value
GPSz = GPSzRecord.Fields ("GPS_z").value
tz = GPSzRecord.Fields ("tz").value
'Executing the Insert Command
DestCmd = "INSERT INTO GPSIMPORT VALUES ( " & tx & ", " & GPSx & ", " & ty & ", " & GPSy & ", " & tz & ", " & GPSz & ") "
DestCon.Execute DestCmd
GPSxRecord.MoveNext
GPSyRecord.MoveNext
GPSzRecord.MoveNext
LoopDo you have a primary key on GPSIMPORT? If not, then your data structure is known as a "heap" and SQL server makes no guarantees about the order in which data is stored, or even the order in which it is retrieved in consecutive statements.
It is not a good idea to rely on the order in which data is inserted to be the order in which it is kept or retrieved. Define a primary key for your data.
blindman|||Thanks a lot Blindman!!
This seems to have worked!! I would have never found that solution.
thanks again,
TRoche|||"First timer having an insert problem."?
Maybe that's why you always remember your first....
First time, replication
uniqueidentifier, column in most of my tables? Is this a
default/necessary behaviour? It is causing some conflicts,
so could this be suppress? TIA
That's a normal behavior for merge replication.
Merge replication requires a universal unique way to identify each row.
So that's why it adds a rowguid to every table involved in a publication
unless this table already possesses a column of such type
"John" <anonymous@.discussions.microsoft.com> a crit dans le message de
news: 10ea01c50fc4$61538f80$a401280a@.phx.gbl...
> Why does the replication process adds a rowguid, a
> uniqueidentifier, column in most of my tables? Is this a
> default/necessary behaviour? It is causing some conflicts,
> so could this be suppress? TIA
First time, it times-out. After that it is fine.
I have a stored procedure that runs slowly and takes over 60 seconds sometimes, but almost all of the time it takes only one or two seconds. In both cases the same input data is used and there have been no changes to the table. The slow running is after the query has not been run for several days.
In the background 16 records are inserted every minute. The table has 5 million records. There are two indexes on the table one is clustered the other is unclustered. They are very well tuned. The record contains a two integers and 90 floats.
The stored procedure gets one record from the database which is the latest record for a particular entity. If I go to the web site after a few days the page times out. If I go to Mgmt Studio, and run the sp form there it takes a very long time but eventually comes back with the correct answer. If execute the stored procedure after that the response is a second or two using the same input data. If I change the input data the response is equally as fast. The web site also works very quickly too.
What is going on and how do I fix it?
Pops73
Try running the SP with SET STATISTICS IO ON, then look at the messages tab. It sounds like the first time you run the query, it is having to do physical reads as opposed to logical reads. The second time you run it, it is doing logical reads, which would be much, much faster.|||Thank you for the response and it sounds reasonable. I restarted the server which I thought would clear the buffer cache and cause the problem to occur. But it didn't after the restart the timeout did not occur. Response was good. Is the buffer cache saved through a restart of a server? How can I clear the cache to easily reproduce the problem and gather the statistics?
Pops73
|||Restarting the server does clear the the buffer cache. You can run the command DBCC FREEPROCCACHE to clear out the procedure cache, and DBCC DROPCLEANBUFFERS to flush the data cache.
http://msdn2.microsoft.com/en-US/library/ms187762.aspx
Run these commands:
DBCC FREEPROCCACHE
GO
CHECKPOINT
GO
DBCC DROPCLEANBUFFERS
|||Thank you for your help. This still does not reproduce the problem.
Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
More info -- I moved the indexes. I have the data in one file group with three files and the indexes in another file group with two files. I still saw the problem.
running Sql Server 2005 sp1
I had the problem yesterday in another db instance of the same applicaiton on another machine. This table only had one record instead of 5 million. Two different queries will show the same problem
Part of the table definition
CREATE TABLE [dbo].[TempMtrScan](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[ShovelID] [int] NOT NULL,
[DateTime] [datetime] NOT NULL,
[FHoistNDE] [float] NULL,
[FHoistDE] [float] NULL,
[FHoistIP] [float] NULL,
[FHoistFLD] [float] NULL, ............
Query 1
INSERT INTO @.TempMtrScanUnpivot ([ShovelID],[TempMtrScanName], [Temperature])
SELECT ShovelID, TempMtrScanName, Temperature
FROM
(SELECT ShovelID,[DateTime],
FHoistNDE,FHoistDE,
RHoistNDE,RHoistDE,
CrowdNDE,CrowdDE,
SwingNDE,SwingDE,
RearSwingNDE,RearSwingDE,
RPropelNDE,RPropelDE,
LPropelNDE,LPropelDE,
LFrontSwingNDE,LFrontSwingDE,
RFrontSwingNDE,RFrontSwingDE,
TransPhaseA,TransPhaseB,TransPhaseC,
DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,
DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,
CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,
PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,
SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,
HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,
PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,
SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,
HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,
SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,
SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,
TempDiffPhsU, TempDiffPhsV, TempDiffPhsW
FROM dbo.TempMtrScan
WHERE [Datetime] =
(SELECT MAX([datetime])
FROM dbo.TempMtrScan
WHERE ShovelID = @.ShovelID)
AND ShovelID = @.ShovelID) A
UNPIVOT (
Temperature
FOR TempMtrScanName
IN ( FHoistNDE,FHoistDE,
RHoistNDE,RHoistDE,
CrowdNDE,CrowdDE,
SwingNDE,SwingDE,
RearSwingNDE,RearSwingDE,
RPropelNDE,RPropelDE,
LPropelNDE,LPropelDE,
LFrontSwingNDE,LFrontSwingDE,
RFrontSwingNDE,RFrontSwingDE,
TransPhaseA,TransPhaseB,TransPhaseC,
DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,
DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,
CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,
PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,
SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,
HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,
PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,
SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,
HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,
SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,
SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,
TempDiffPhsU, TempDiffPhsV, TempDiffPhsW
)
) AS unpvt
Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Query 2
SELECT
(max(T.FHoistNDE)* 1.8 + 32) as "FHoistNDE" ,
(max(T.FHoistDE)* 1.8 + 32) as "FHoistDE" ,
(max(T.FHoistIP)* 1.8 + 32) as "FHoistIP" ,
(max(T.FHoistFLD)* 1.8 + 32) as "FHoistFLD" ,
(max(T.RHoistNDE)* 1.8 + 32) as "RHoistNDE" ,
(max(T.RHoistDE)* 1.8 + 32) as "RHoistDE" ,
(max(T.RHoistIP)* 1.8 + 32) as "RHoistIP" ,
(max(T.RHoistFLD)* 1.8 + 32) as "RHoistFLD" ,
(max(T.CrowdNDE)* 1.8 + 32) as "CrowdNDE" ,
(max(T.CrowdDE) * 1.8 + 32) as "CrowdDE" ,
(max(T.CrowdIP) * 1.8 + 32) as "CrowdIP" ,
(max(T.CrowdFLD) * 1.8 + 32) as "CrowdFLD" ,
(max(T.SwingNDE)* 1.8 + 32) as "SwingNDE" ,
(max(T.SwingDE) * 1.8 + 32) as "SwingDE" ,
(max(T.SwingIP) * 1.8 + 32) as "SwingIP" ,
(max(T.SwingFLD)* 1.8 + 32) as "SwingFLD" ,
(max(T.RearSwingNDE)* 1.8 + 32) as "RearSwingNDE" ,
(max(T.RearSwingDE) * 1.8 + 32) as "RearSwingDE" ,
(max(T.RearSwingIP) * 1.8 + 32) as "RearSwingIP" ,
(max(T.RearSwingFLD)* 1.8 + 32) as "RearSwingFLD" ,
(max(T.RPropelNDE) * 1.8 + 32) as "RPropelNDE" ,
(max(T.RPropelDE)* 1.8 + 32) as "RPropelDE" ,
(max(T.RPropelIP) * 1.8 + 32) as "RPropelIP" ,
(max(T.RPropelFLD) * 1.8 + 32) as "RPropelFLD" ,
(max(T.LPropelNDE) * 1.8 + 32) as "LPropelNDE" ,
(max(T.LPropelDE) * 1.8 + 32) as "LPropelDE" ,
(max(T.LPropelIP) * 1.8 + 32) as "LPropelIP" ,
(max(T.LPropelFLD) * 1.8 + 32) as "LPropelFLD" ,
(max(T.LFrontSwingNDE)* 1.8 + 32) as "LFrontSwingNDE" ,
(max(T.LFrontSwingDE)* 1.8 + 32) as "LFrontSwingDE" ,
(max(T.LFrontSwingIP) * 1.8 + 32) as "LFrontSwingIP" ,
(max(T.LFrontSwingFLD) * 1.8 + 32) as "LFrontSwingFLD" ,
(max(T.RFrontSwingNDE) * 1.8 + 32) as "RFrontSwingNDE" ,
(max(T.RFrontSwingDE) * 1.8 + 32) as "RFrontSwingDE" ,
(max(T.RFrontSwingIP)* 1.8 + 32) as "RFrontSwingIP" ,
(max(T.RFrontSwingFLD) * 1.8 + 32) as "RFrontSwingFLD" ,
(max(T.TransPhaseA)* 1.8 + 32) as "TransPhaseA" ,
(max(T.TransPhaseB)* 1.8 + 32) as "TransPhaseB" ,
(max(T.TransPhaseC)* 1.8 + 32) as "TransPhaseC" ,
(max(T.DriveInletTemp1)* 1.8 + 32) as "DriveInletTemp1" ,
(max(T.DriveInletTemp2)* 1.8 + 32) as "DriveInletTemp2" ,
(max(T.DriveInletTemp3)* 1.8 + 32) as "DriveInletTemp3" ,
(max(T.DriveInletTemp4)* 1.8 + 32) as "DriveInletTemp4" ,
(max(T.DriveInletTemp5)* 1.8 + 32) as "DriveInletTemp5" ,
(max(T.DriveInletTemp6)* 1.8 + 32) as "DriveInletTemp6" ,
(max(T.DriveInletTemp7)* 1.8 + 32) as "DriveInletTemp7" ,
(max(T.DriveInletTemp8)* 1.8 + 32) as "DriveInletTemp8" ,
(max(T.CwdMotorTemp)* 1.8 + 32) as "CwdMotorTemp" ,
(max(T.CwdMotorWindABTemp)* 1.8 + 32) as "CwdMotorWindABTemp" ,
(max(T.CwdMotorWindBCTemp)* 1.8 + 32) as "CwdMotorWindBCTemp" ,
(max(T.CwdMotorWindCATemp)* 1.8 + 32) as "CwdMotorWindCATemp" ,
(max(T.PplRhtMtrMotorTemp)* 1.8 + 32) as "PplRhtMtrMotorTemp" ,
(max(T.PplRhtMtrMotorWindABTemp)* 1.8 + 32) as "PplRhtMtrMotorWindABTemp" ,
(max(T.PplRhtMtrMotorWindBCTemp)* 1.8 + 32) as "PplRhtMtrMotorWindBCTemp" ,
(max(T.PplRhtMtrMotorWindCATemp)* 1.8 + 32) as "PplRhtMtrMotorWindCATemp" ,
(max(T.SwgLFntMtrMotorTemp)* 1.8 + 32) as "SwgLFntMtrMotorTemp" ,
(max(T.SwgLFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindABTemp" ,
(max(T.SwgLFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindBCTemp" ,
(max(T.SwgLFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgLFntMtrMotorWindCATemp" ,
(max(T.HstRearMtrMotorTemp)* 1.8 + 32) as "HstRearMtrMotorTemp" ,
(max(T.HstRearMtrMotorWindABTemp)* 1.8 + 32) as "HstRearMtrMotorWindABTemp" ,
(max(T.HstRearMtrMotorWindBCTemp)* 1.8 + 32) as "HstRearMtrMotorWindBCTemp" ,
(max(T.HstRearMtrMotorWindCATemp)* 1.8 + 32) as "HstRearMtrMotorWindCATemp" ,
(max(T.PplLftMtrMotorTemp)* 1.8 + 32) as "PplLftMtrMotorTemp" ,
(max(T.PplLftMtrMotorWindABTemp)* 1.8 + 32) as "PplLftMtrMotorWindABTemp" ,
(max(T.PplLftMtrMotorWindBCTemp)* 1.8 + 32) as "PplLftMtrMotorWindBCTemp" ,
(max(T.PplLftMtrMotorWindCATemp)* 1.8 + 32) as "PplLftMtrMotorWindCATemp" ,
(max(T.SwgRFntMtrMotorTemp)* 1.8 + 32) as "SwgRFntMtrMotorTemp" ,
(max(T.SwgRFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindABTemp" ,
(max(T.SwgRFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindBCTemp" ,
(max(T.SwgRFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgRFntMtrMotorWindCATemp" ,
(max(T.HstFntMtrMotorTemp)* 1.8 + 32) as "HstFntMtrMotorTemp" ,
(max(T.HstFntMtrMotorWindABTemp)* 1.8 + 32) as "HstFntMtrMotorWindABTemp" ,
(max(T.HstFntMtrMotorWindBCTemp)* 1.8 + 32) as "HstFntMtrMotorWindBCTemp" ,
(max(T.HstFntMtrMotorWindCATemp)* 1.8 + 32) as "HstFntMtrMotorWindCATemp" ,
(max(T.SwgRearMtrMotorTemp)* 1.8 + 32) as "SwgRearMtrMotorTemp" ,
(max(T.SwgRearMtrMotorWindABTemp)* 1.8 + 32) as "SwgRearMtrMotorWindABTemp" ,
(max(T.SwgRearMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRearMtrMotorWindBCTemp" ,
(max(T.SwgRearMtrMotorWindCATemp)* 1.8 + 32) as "SwgRearMtrMotorWindCATemp" ,
(max(T.SwgFntMtrMotorTemp)* 1.8 + 32) as "SwgFntMtrMotorTemp" ,
(max(T.SwgFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgFntMtrMotorWindABTemp" ,
(max(T.SwgFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,
(max(T.SwgFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,
(max(T.ACS800Temp)* 1.8 + 32) as "ACS800Temp" ,
(max(T.TempDiffPhsU)* 1.8 + 32) as "TempDiffPhsU" ,
(max(T.TempDiffPhsV)* 1.8 + 32) as "TempDiffPhsV" ,
(max(T.TempDiffPhsW)* 1.8 + 32) as "TempDiffPhsW" ,
Max(T.DateTime) as "TemperatureTime"
FROM TempMtrScan T
JOIN Shovel S ON T.ShovelID = S.ID
WHERE (S.ID =@.ShovelID) AND T.DATETIME <= @.EndTime AND T.DATETIME >= @.StartTime
Group by ShovelID, datepart(yy,T.DateTime), datepart(dy,T.DateTime),datepart(hh,T.DateTime),datepart(mi,T.DateTime)/@.Duration
order by Max(T.DateTime) asc
(1943 row(s) affected)
Table 'Shovel'. Scan count 0, logical reads 2, physical reads 2, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 3, logical reads 38911, physical reads 493, read-ahead reads 736, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Warning: Null value is eliminated by an aggregate or other SET operation.
First time, it times out. After that it is fine.
I have a stored procedure that runs slowly and takes over 60 seconds sometimes, but almost all of the time it takes only one or two seconds. In both cases the same input data is used and there have been no changes to the table. The slow running is after the query has not been run for several days.
In the background 16 records are inserted every minute. The table has 5 million records. There are two indexes on the table one is clustered the other is unclustered. They are very well tuned. The record contains a two integers and 90 floats.
The stored procedure gets one record from the database which is the latest record for a particular entity. If I go to the web site after a few days the page times out. If I go to Mgmt Studio, and run the sp form there it takes a very long time but eventually comes back with the correct answer. If execute the stored procedure after that the response is a second or two using the same input data. If I change the input data the response is equally as fast. The web site also works very quickly too.
What is going on and how do I fix it?
Pops73
Try running the SP with SET STATISTICS IO ON, then look at the messages tab. It sounds like the first time you run the query, it is having to do physical reads as opposed to logical reads. The second time you run it, it is doing logical reads, which would be much, much faster.|||Thank you for the response and it sounds reasonable. I restarted the server which I thought would clear the buffer cache and cause the problem to occur. But it didn't after the restart the timeout did not occur. Response was good. Is the buffer cache saved through a restart of a server? How can I clear the cache to easily reproduce the problem and gather the statistics?
Pops73
|||Restarting the server does clear the the buffer cache. You can run the command DBCC FREEPROCCACHE to clear out the procedure cache, and DBCC DROPCLEANBUFFERS to flush the data cache.
http://msdn2.microsoft.com/en-US/library/ms187762.aspx
Run these commands:
DBCC FREEPROCCACHE
GO
CHECKPOINT
GO
DBCC DROPCLEANBUFFERS
|||Thank you for your help. This still does not reproduce the problem.
Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
More info -- I moved the indexes. I have the data in one file group with three files and the indexes in another file group with two files. I still saw the problem.
running Sql Server 2005 sp1
I had the problem yesterday in another db instance of the same applicaiton on another machine. This table only had one record instead of 5 million. Two different queries will show the same problem
Part of the table definition
CREATE TABLE [dbo].[TempMtrScan](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[ShovelID] [int] NOT NULL,
[DateTime] [datetime] NOT NULL,
[FHoistNDE] [float] NULL,
[FHoistDE] [float] NULL,
[FHoistIP] [float] NULL,
[FHoistFLD] [float] NULL, ............
Query 1
INSERT INTO @.TempMtrScanUnpivot ([ShovelID],[TempMtrScanName], [Temperature])
SELECT ShovelID, TempMtrScanName, Temperature
FROM
(SELECT ShovelID,[DateTime],
FHoistNDE,FHoistDE,
RHoistNDE,RHoistDE,
CrowdNDE,CrowdDE,
SwingNDE,SwingDE,
RearSwingNDE,RearSwingDE,
RPropelNDE,RPropelDE,
LPropelNDE,LPropelDE,
LFrontSwingNDE,LFrontSwingDE,
RFrontSwingNDE,RFrontSwingDE,
TransPhaseA,TransPhaseB,TransPhaseC,
DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,
DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,
CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,
PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,
SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,
HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,
PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,
SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,
HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,
SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,
SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,
TempDiffPhsU, TempDiffPhsV, TempDiffPhsW
FROM dbo.TempMtrScan
WHERE [Datetime] =
(SELECT MAX([datetime])
FROM dbo.TempMtrScan
WHERE ShovelID = @.ShovelID)
AND ShovelID = @.ShovelID) A
UNPIVOT (
Temperature
FOR TempMtrScanName
IN ( FHoistNDE,FHoistDE,
RHoistNDE,RHoistDE,
CrowdNDE,CrowdDE,
SwingNDE,SwingDE,
RearSwingNDE,RearSwingDE,
RPropelNDE,RPropelDE,
LPropelNDE,LPropelDE,
LFrontSwingNDE,LFrontSwingDE,
RFrontSwingNDE,RFrontSwingDE,
TransPhaseA,TransPhaseB,TransPhaseC,
DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,
DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,
CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,
PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,
SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,
HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,
PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,
SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,
HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,
SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,
SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,
TempDiffPhsU, TempDiffPhsV, TempDiffPhsW
)
) AS unpvt
Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Query 2
SELECT
(max(T.FHoistNDE)* 1.8 + 32) as "FHoistNDE" ,
(max(T.FHoistDE)* 1.8 + 32) as "FHoistDE" ,
(max(T.FHoistIP)* 1.8 + 32) as "FHoistIP" ,
(max(T.FHoistFLD)* 1.8 + 32) as "FHoistFLD" ,
(max(T.RHoistNDE)* 1.8 + 32) as "RHoistNDE" ,
(max(T.RHoistDE)* 1.8 + 32) as "RHoistDE" ,
(max(T.RHoistIP)* 1.8 + 32) as "RHoistIP" ,
(max(T.RHoistFLD)* 1.8 + 32) as "RHoistFLD" ,
(max(T.CrowdNDE)* 1.8 + 32) as "CrowdNDE" ,
(max(T.CrowdDE) * 1.8 + 32) as "CrowdDE" ,
(max(T.CrowdIP) * 1.8 + 32) as "CrowdIP" ,
(max(T.CrowdFLD) * 1.8 + 32) as "CrowdFLD" ,
(max(T.SwingNDE)* 1.8 + 32) as "SwingNDE" ,
(max(T.SwingDE) * 1.8 + 32) as "SwingDE" ,
(max(T.SwingIP) * 1.8 + 32) as "SwingIP" ,
(max(T.SwingFLD)* 1.8 + 32) as "SwingFLD" ,
(max(T.RearSwingNDE)* 1.8 + 32) as "RearSwingNDE" ,
(max(T.RearSwingDE) * 1.8 + 32) as "RearSwingDE" ,
(max(T.RearSwingIP) * 1.8 + 32) as "RearSwingIP" ,
(max(T.RearSwingFLD)* 1.8 + 32) as "RearSwingFLD" ,
(max(T.RPropelNDE) * 1.8 + 32) as "RPropelNDE" ,
(max(T.RPropelDE)* 1.8 + 32) as "RPropelDE" ,
(max(T.RPropelIP) * 1.8 + 32) as "RPropelIP" ,
(max(T.RPropelFLD) * 1.8 + 32) as "RPropelFLD" ,
(max(T.LPropelNDE) * 1.8 + 32) as "LPropelNDE" ,
(max(T.LPropelDE) * 1.8 + 32) as "LPropelDE" ,
(max(T.LPropelIP) * 1.8 + 32) as "LPropelIP" ,
(max(T.LPropelFLD) * 1.8 + 32) as "LPropelFLD" ,
(max(T.LFrontSwingNDE)* 1.8 + 32) as "LFrontSwingNDE" ,
(max(T.LFrontSwingDE)* 1.8 + 32) as "LFrontSwingDE" ,
(max(T.LFrontSwingIP) * 1.8 + 32) as "LFrontSwingIP" ,
(max(T.LFrontSwingFLD) * 1.8 + 32) as "LFrontSwingFLD" ,
(max(T.RFrontSwingNDE) * 1.8 + 32) as "RFrontSwingNDE" ,
(max(T.RFrontSwingDE) * 1.8 + 32) as "RFrontSwingDE" ,
(max(T.RFrontSwingIP)* 1.8 + 32) as "RFrontSwingIP" ,
(max(T.RFrontSwingFLD) * 1.8 + 32) as "RFrontSwingFLD" ,
(max(T.TransPhaseA)* 1.8 + 32) as "TransPhaseA" ,
(max(T.TransPhaseB)* 1.8 + 32) as "TransPhaseB" ,
(max(T.TransPhaseC)* 1.8 + 32) as "TransPhaseC" ,
(max(T.DriveInletTemp1)* 1.8 + 32) as "DriveInletTemp1" ,
(max(T.DriveInletTemp2)* 1.8 + 32) as "DriveInletTemp2" ,
(max(T.DriveInletTemp3)* 1.8 + 32) as "DriveInletTemp3" ,
(max(T.DriveInletTemp4)* 1.8 + 32) as "DriveInletTemp4" ,
(max(T.DriveInletTemp5)* 1.8 + 32) as "DriveInletTemp5" ,
(max(T.DriveInletTemp6)* 1.8 + 32) as "DriveInletTemp6" ,
(max(T.DriveInletTemp7)* 1.8 + 32) as "DriveInletTemp7" ,
(max(T.DriveInletTemp8)* 1.8 + 32) as "DriveInletTemp8" ,
(max(T.CwdMotorTemp)* 1.8 + 32) as "CwdMotorTemp" ,
(max(T.CwdMotorWindABTemp)* 1.8 + 32) as "CwdMotorWindABTemp" ,
(max(T.CwdMotorWindBCTemp)* 1.8 + 32) as "CwdMotorWindBCTemp" ,
(max(T.CwdMotorWindCATemp)* 1.8 + 32) as "CwdMotorWindCATemp" ,
(max(T.PplRhtMtrMotorTemp)* 1.8 + 32) as "PplRhtMtrMotorTemp" ,
(max(T.PplRhtMtrMotorWindABTemp)* 1.8 + 32) as "PplRhtMtrMotorWindABTemp" ,
(max(T.PplRhtMtrMotorWindBCTemp)* 1.8 + 32) as "PplRhtMtrMotorWindBCTemp" ,
(max(T.PplRhtMtrMotorWindCATemp)* 1.8 + 32) as "PplRhtMtrMotorWindCATemp" ,
(max(T.SwgLFntMtrMotorTemp)* 1.8 + 32) as "SwgLFntMtrMotorTemp" ,
(max(T.SwgLFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindABTemp" ,
(max(T.SwgLFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindBCTemp" ,
(max(T.SwgLFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgLFntMtrMotorWindCATemp" ,
(max(T.HstRearMtrMotorTemp)* 1.8 + 32) as "HstRearMtrMotorTemp" ,
(max(T.HstRearMtrMotorWindABTemp)* 1.8 + 32) as "HstRearMtrMotorWindABTemp" ,
(max(T.HstRearMtrMotorWindBCTemp)* 1.8 + 32) as "HstRearMtrMotorWindBCTemp" ,
(max(T.HstRearMtrMotorWindCATemp)* 1.8 + 32) as "HstRearMtrMotorWindCATemp" ,
(max(T.PplLftMtrMotorTemp)* 1.8 + 32) as "PplLftMtrMotorTemp" ,
(max(T.PplLftMtrMotorWindABTemp)* 1.8 + 32) as "PplLftMtrMotorWindABTemp" ,
(max(T.PplLftMtrMotorWindBCTemp)* 1.8 + 32) as "PplLftMtrMotorWindBCTemp" ,
(max(T.PplLftMtrMotorWindCATemp)* 1.8 + 32) as "PplLftMtrMotorWindCATemp" ,
(max(T.SwgRFntMtrMotorTemp)* 1.8 + 32) as "SwgRFntMtrMotorTemp" ,
(max(T.SwgRFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindABTemp" ,
(max(T.SwgRFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindBCTemp" ,
(max(T.SwgRFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgRFntMtrMotorWindCATemp" ,
(max(T.HstFntMtrMotorTemp)* 1.8 + 32) as "HstFntMtrMotorTemp" ,
(max(T.HstFntMtrMotorWindABTemp)* 1.8 + 32) as "HstFntMtrMotorWindABTemp" ,
(max(T.HstFntMtrMotorWindBCTemp)* 1.8 + 32) as "HstFntMtrMotorWindBCTemp" ,
(max(T.HstFntMtrMotorWindCATemp)* 1.8 + 32) as "HstFntMtrMotorWindCATemp" ,
(max(T.SwgRearMtrMotorTemp)* 1.8 + 32) as "SwgRearMtrMotorTemp" ,
(max(T.SwgRearMtrMotorWindABTemp)* 1.8 + 32) as "SwgRearMtrMotorWindABTemp" ,
(max(T.SwgRearMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRearMtrMotorWindBCTemp" ,
(max(T.SwgRearMtrMotorWindCATemp)* 1.8 + 32) as "SwgRearMtrMotorWindCATemp" ,
(max(T.SwgFntMtrMotorTemp)* 1.8 + 32) as "SwgFntMtrMotorTemp" ,
(max(T.SwgFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgFntMtrMotorWindABTemp" ,
(max(T.SwgFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,
(max(T.SwgFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,
(max(T.ACS800Temp)* 1.8 + 32) as "ACS800Temp" ,
(max(T.TempDiffPhsU)* 1.8 + 32) as "TempDiffPhsU" ,
(max(T.TempDiffPhsV)* 1.8 + 32) as "TempDiffPhsV" ,
(max(T.TempDiffPhsW)* 1.8 + 32) as "TempDiffPhsW" ,
Max(T.DateTime) as "TemperatureTime"
FROM TempMtrScan T
JOIN Shovel S ON T.ShovelID = S.ID
WHERE (S.ID =@.ShovelID) AND T.DATETIME <= @.EndTime AND T.DATETIME >= @.StartTime
Group by ShovelID, datepart(yy,T.DateTime), datepart(dy,T.DateTime),datepart(hh,T.DateTime),datepart(mi,T.DateTime)/@.Duration
order by Max(T.DateTime) asc
(1943 row(s) affected)
Table 'Shovel'. Scan count 0, logical reads 2, physical reads 2, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 3, logical reads 38911, physical reads 493, read-ahead reads 736, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Warning: Null value is eliminated by an aggregate or other SET operation.
First time writing, string manipulation?
For Example:
"GOLF IS FUN,BOWLING IS GREAT"
What Id like to get as my results:
"Golf is fun, Bowling is great"
Trying to figure out the syntax to get the character after the comma to have a space then capital "B" Thought I could use a charindex but just cant seem to get it.Hi
Welcome to the forum :D
By coincidence I was tootling around Vyas's site earlier today and noticed his proper case function.
http://vyaskn.tripod.com/code.htm#propercase
I am confess I have not used it in anger. I would not be surprised if an extended sproc might be a little faster. There is one optimisation I would do in the first place - one single SELECT @.var = 'this', @.other_var = 'that' rather than multiple SETs.
Anyhoo - see how you get on.
HTH|||Oops - just noticed you are not after propercase. Check out PATINDEX for your requirement e.g. PATINDEX('%, %', MyCol)|||CREATE Proc sp_Parsing( @.String Varchar(255))
AS
Declare @.Recepient Varchar(100)
Declare @.Comma Int
DEclare @.OutPut varchar(8000)
create Table #Test(Names Varchar(55))
set nocount on
While @.String is not null
Begin
Set @.Comma = Patindex('%,%',@.String)
if @.Comma <> 0
Begin
Select @.recepient = Ltrim(Rtrim(Substring(@.string,1,(@.Comma - 1))))
Select @.String = Ltrim(Rtrim(Substring(@.String,(@.Comma + 1),255)))
Insert Into #Test
Values(@.Recepient)
Continue
End
Else
Begin
Select @.recepient = @.string
Select @.String = null
Insert Into #Test
Values(@.Recepient)
Break
End
End
set @.OutPut = ''
Select @.OutPut = @.OutPut + Upper(substring(Names,1,1)) + Lower(Substring(Names,2, Len(Names))) + ',' from #test
Select substring(@.OutPut,1, len( @.OutPut) -1)
Drop Table #Test
GO
Exec sp_Parsing 'GOLF IS FUN,BOWLING IS GREAT'|||string manipulation is pretty much always better done in compiled code, not sql, as pootle suggests.
what sql is good at is set based operations.
First time user that can't find answer. Need online website.
HI! Thank you for even looking at this question.
I need to get a website up and running for a small group of people. I've had SQL Server for a while, but didn't have any use for it. It came with Visual Studio 2005, which gave me a little know how on scripting. Now, I have Visual Web Developer and what I need to make a web page. I just need to know how to configure all my settings to allow my website to be viewed online by anyone with an internet connection. I'm a person that understands detailed or simple directions, but I can not seem to find directions online. Now, I know what your thinking, but I've never attemped anything like this before. So, please, HELP! I need and want to learn as much as possible.
Thank you, tecfreak213
P.S. also, how do I change or get a web address? Thanks.
Hi,
Welcome to Forum.
You will require a Web Server (Internet Information Server ), A dedicated Internet connection, SQL Server, IP Address to bind to web server, Domain Name
Setup SQL Server with Database
Setup IIS Server (with Internet Connection and dedicated IP address bind to that, refer below article on how to setup IIS)
http://www.no-ip.com/support/guides/web_servers/setting_up_iis.html
http://www.webwizguide.com/asp/tutorials/installing_iis_winXP_pro.asp
http://www.webmasterstop.com/122.html
Create Directory on the IIS Server and deploy you web application in it
Bind you Directory to IIS
HTH
Hemantgiri S. Goswami
First time user
I have not been able to locate it if it is. Do I have to load it
separately when I load SQL server?SQL Server Reporting Services is licensed with SQL Server 2000, but it is
separate software. If you have an MSDN subscription it is on the September
2004 DVD (Disc 2432.6, it's a red disc). Otherwise, you will need to contact
the vendor from whom you purchased SQL Server 2000 to obtain the media. You
will also want to download and install Service Pack 1 which is available at:
http://www.microsoft.com/sql/reporting/downloads/default.asp
"George" wrote:
> I was told that Reporting Services is included in SQL server 2000 but
> I have not been able to locate it if it is. Do I have to load it
> separately when I load SQL server?
>|||On 15 Nov 2004 11:41:48 -0800, george.hunter@.conagrafoods.com (George)
wrote:
>I was told that Reporting Services is included in SQL server 2000 but
>I have not been able to locate it if it is. Do I have to load it
>separately when I load SQL server?
George,
You can download a trial version from
http://www.microsoft.com/sql/reporting/downloads/default.asp. (Scroll
down a little)
As far I am aware, the full version is available only on CD or on MSDN
(not sure what levels).
Andrew Watt
MVP - InfoPath|||Dear George and NG,
I am in the same boat you are in. In addition, I could not read this
NewsGroup using Outlook Express and netnews.attbi.com. Perhaps Comcast has
put it somewhere else. I am using IE and the MSDN subscription to reach this
message. The real purpose of this post is to see if this approach to
newsgroups works. I am going to try to set up RS this morning from my MSDN
DVDs. In order to use RS I am going to have to transfer my application
development from MSDE to full blown SQL Server 2000.
Thanks for your question and the replies,
Bob
--
Robert Schuldenfrei
S. I. Inc.
bob@.s-i-inc.com
"George" wrote:
> I was told that Reporting Services is included in SQL server 2000 but
> I have not been able to locate it if it is. Do I have to load it
> separately when I load SQL server?
>
First time use of Analysis Services
First time setting up SQL MSDE, trouble loggin in...
I also get an error when trying to connect using Web Data Administrator: "Invalid username and/or password, or server does not exist. Also, please ensure that SQL Server Authentication is enabled on the server. " I am using the "sa" account with the correct password. I have also tried no password (just in case) and that doesn't work either.
I cannot confirm that I have SQL Server Authentication enabled. I have no idea how to check for this using SQL MSDE. This may be part of the problem...any thoughts on this issue?
My OS: Windows XP Professional Service Pack 1 (Build 2600)
My Web Server: Internet Information Services Version 5.1.2600.0
My .NET Framework: .NET Framework Version 1.1.4322.573
My SQL Server: Microsoft SQL Server Desktop Engine (SQL Server Version 8.00.760)
Other Info: .NET is fine and linked to IIS, all other .NET apps compile/run fine. SQL Server Service Manager is giving me the green arrow. My OS is MS WinXP Pro, all SP's and hot fixes and updates applied.
I will be monitoring this post and trying any suggestions right away & posting my success/failure right back here.
If anyone would like to see a screen shot of the error generated by the Time Tracker install, use the following link:
http://www.versyss.com/mike/shot.gif
Thanks in advance!First, to determine with authentication mode you are using, go to the Windows command prompt and type this command:
osql -d Master -Q "xp_loginconfig" -E
Terri|||Results of: osql -d Master -Q "xp_loginconfig" -E
Name: Config_Value
--------
login mode:Windows NT Authentication
default login:guest
default domain:Null
audit level:none
set hostname:false
map _ :domain separator
map $:Null
map #:-
So it looks like I am using Win. NT Auth. mode. Now how do I switch this to SQL Server Auth. or Mixed Mode? Remember this is a MSDE installation so I have no Enterprise Manager...
Thanks sof the help so far....Mike|||Without Enterprise Manager, you could edit the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer
Change LoginMode to 1 for "Windows Only", 2 for "SQL Server and Windows"
As always, use care when editing the registry. It should be backed up first. If you've never edited the registry, you should read up on it first. I claim no responsibility!
Terri|||Terri, you RULE!
It worked. I edited the reg value you indicated, rebooted, ran "osql -d Master -Q "xp_loginconfig" -E" and verified my mode (which now reads "mixed") and was able to log into my server using Web Data Admin! Thanks so much! I hope this posts helps some other people as well!
P.S. The use of "localhost" didn't work for the server. I think I read somewhere that the "localhost" option has been disabled in MSDE. I don't know for sure but all I know is that "localhost" didn't work for me but the server name and IP address do...
Thanks again Terri...
First time it times out after that it is fine
I have a stored procedure that runs slowly and takes over 60 seconds sometimes, but almost all of the time it takes only one or two seconds. In both cases the same input data is used and there have been no changes to the table. The slow running is after the query has not been run for several days.
In the background 16 records are inserted every minute. The table has 5 million records. There are two indexes on the table one is clustered the other is unclustered. They are very well tuned. The record contains a two integers and 90 floats.
The stored procedure gets one record from the database which is the latest record for a particular entity. If I go to the web site after a few days the page times out. If I go to Mgmt Studio, and run the sp form there it takes a very long time but eventually comes back with the correct answer. If execute the stored procedure after that the response is a second or two using the same input data. If I change the input data the response is equally as fast. The web site also works very quickly too.
What is going on and how do I fix it?
Pops73
Try running the SP with SET STATISTICS IO ON, then look at the messages tab. It sounds like the first time you run the query, it is having to do physical reads as opposed to logical reads. The second time you run it, it is doing logical reads, which would be much, much faster.|||Thank you for the response and it sounds reasonable. I restarted the server which I thought would clear the buffer cache and cause the problem to occur. But it didn't after the restart the timeout did not occur. Response was good. Is the buffer cache saved through a restart of a server? How can I clear the cache to easily reproduce the problem and gather the statistics?
Pops73
|||Restarting the server does clear the the buffer cache. You can run the command DBCC FREEPROCCACHE to clear out the procedure cache, and DBCC DROPCLEANBUFFERS to flush the data cache.
http://msdn2.microsoft.com/en-US/library/ms187762.aspx
Run these commands:
DBCC FREEPROCCACHE
GO
CHECKPOINT
GO
DBCC DROPCLEANBUFFERS
|||Thank you for your help. This still does not reproduce the problem.
Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
More info -- I moved the indexes. I have the data in one file group with three files and the indexes in another file group with two files. I still saw the problem.
running Sql Server 2005 sp1
I had the problem yesterday in another db instance of the same applicaiton on another machine. This table only had one record instead of 5 million. Two different queries will show the same problem
Part of the table definition
CREATE TABLE [dbo].[TempMtrScan](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[ShovelID] [int] NOT NULL,
[DateTime] [datetime] NOT NULL,
[FHoistNDE] [float] NULL,
[FHoistDE] [float] NULL,
[FHoistIP] [float] NULL,
[FHoistFLD] [float] NULL, ............
Query 1
INSERT INTO @.TempMtrScanUnpivot ([ShovelID],[TempMtrScanName], [Temperature])
SELECT ShovelID, TempMtrScanName, Temperature
FROM
(SELECT ShovelID,[DateTime],
FHoistNDE,FHoistDE,
RHoistNDE,RHoistDE,
CrowdNDE,CrowdDE,
SwingNDE,SwingDE,
RearSwingNDE,RearSwingDE,
RPropelNDE,RPropelDE,
LPropelNDE,LPropelDE,
LFrontSwingNDE,LFrontSwingDE,
RFrontSwingNDE,RFrontSwingDE,
TransPhaseA,TransPhaseB,TransPhaseC,
DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,
DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,
CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,
PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,
SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,
HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,
PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,
SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,
HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,
SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,
SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,
TempDiffPhsU, TempDiffPhsV, TempDiffPhsW
FROM dbo.TempMtrScan
WHERE [Datetime] =
(SELECT MAX([datetime])
FROM dbo.TempMtrScan
WHERE ShovelID = @.ShovelID)
AND ShovelID = @.ShovelID) A
UNPIVOT (
Temperature
FOR TempMtrScanName
IN ( FHoistNDE,FHoistDE,
RHoistNDE,RHoistDE,
CrowdNDE,CrowdDE,
SwingNDE,SwingDE,
RearSwingNDE,RearSwingDE,
RPropelNDE,RPropelDE,
LPropelNDE,LPropelDE,
LFrontSwingNDE,LFrontSwingDE,
RFrontSwingNDE,RFrontSwingDE,
TransPhaseA,TransPhaseB,TransPhaseC,
DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,
DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,
CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,
PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,
SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,
HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,
PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,
SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,
HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,
SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,
SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,
TempDiffPhsU, TempDiffPhsV, TempDiffPhsW
)
) AS unpvt
Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Query 2
SELECT
(max(T.FHoistNDE)* 1.8 + 32) as "FHoistNDE" ,
(max(T.FHoistDE)* 1.8 + 32) as "FHoistDE" ,
(max(T.FHoistIP)* 1.8 + 32) as "FHoistIP" ,
(max(T.FHoistFLD)* 1.8 + 32) as "FHoistFLD" ,
(max(T.RHoistNDE)* 1.8 + 32) as "RHoistNDE" ,
(max(T.RHoistDE)* 1.8 + 32) as "RHoistDE" ,
(max(T.RHoistIP)* 1.8 + 32) as "RHoistIP" ,
(max(T.RHoistFLD)* 1.8 + 32) as "RHoistFLD" ,
(max(T.CrowdNDE)* 1.8 + 32) as "CrowdNDE" ,
(max(T.CrowdDE) * 1.8 + 32) as "CrowdDE" ,
(max(T.CrowdIP) * 1.8 + 32) as "CrowdIP" ,
(max(T.CrowdFLD) * 1.8 + 32) as "CrowdFLD" ,
(max(T.SwingNDE)* 1.8 + 32) as "SwingNDE" ,
(max(T.SwingDE) * 1.8 + 32) as "SwingDE" ,
(max(T.SwingIP) * 1.8 + 32) as "SwingIP" ,
(max(T.SwingFLD)* 1.8 + 32) as "SwingFLD" ,
(max(T.RearSwingNDE)* 1.8 + 32) as "RearSwingNDE" ,
(max(T.RearSwingDE) * 1.8 + 32) as "RearSwingDE" ,
(max(T.RearSwingIP) * 1.8 + 32) as "RearSwingIP" ,
(max(T.RearSwingFLD)* 1.8 + 32) as "RearSwingFLD" ,
(max(T.RPropelNDE) * 1.8 + 32) as "RPropelNDE" ,
(max(T.RPropelDE)* 1.8 + 32) as "RPropelDE" ,
(max(T.RPropelIP) * 1.8 + 32) as "RPropelIP" ,
(max(T.RPropelFLD) * 1.8 + 32) as "RPropelFLD" ,
(max(T.LPropelNDE) * 1.8 + 32) as "LPropelNDE" ,
(max(T.LPropelDE) * 1.8 + 32) as "LPropelDE" ,
(max(T.LPropelIP) * 1.8 + 32) as "LPropelIP" ,
(max(T.LPropelFLD) * 1.8 + 32) as "LPropelFLD" ,
(max(T.LFrontSwingNDE)* 1.8 + 32) as "LFrontSwingNDE" ,
(max(T.LFrontSwingDE)* 1.8 + 32) as "LFrontSwingDE" ,
(max(T.LFrontSwingIP) * 1.8 + 32) as "LFrontSwingIP" ,
(max(T.LFrontSwingFLD) * 1.8 + 32) as "LFrontSwingFLD" ,
(max(T.RFrontSwingNDE) * 1.8 + 32) as "RFrontSwingNDE" ,
(max(T.RFrontSwingDE) * 1.8 + 32) as "RFrontSwingDE" ,
(max(T.RFrontSwingIP)* 1.8 + 32) as "RFrontSwingIP" ,
(max(T.RFrontSwingFLD) * 1.8 + 32) as "RFrontSwingFLD" ,
(max(T.TransPhaseA)* 1.8 + 32) as "TransPhaseA" ,
(max(T.TransPhaseB)* 1.8 + 32) as "TransPhaseB" ,
(max(T.TransPhaseC)* 1.8 + 32) as "TransPhaseC" ,
(max(T.DriveInletTemp1)* 1.8 + 32) as "DriveInletTemp1" ,
(max(T.DriveInletTemp2)* 1.8 + 32) as "DriveInletTemp2" ,
(max(T.DriveInletTemp3)* 1.8 + 32) as "DriveInletTemp3" ,
(max(T.DriveInletTemp4)* 1.8 + 32) as "DriveInletTemp4" ,
(max(T.DriveInletTemp5)* 1.8 + 32) as "DriveInletTemp5" ,
(max(T.DriveInletTemp6)* 1.8 + 32) as "DriveInletTemp6" ,
(max(T.DriveInletTemp7)* 1.8 + 32) as "DriveInletTemp7" ,
(max(T.DriveInletTemp8)* 1.8 + 32) as "DriveInletTemp8" ,
(max(T.CwdMotorTemp)* 1.8 + 32) as "CwdMotorTemp" ,
(max(T.CwdMotorWindABTemp)* 1.8 + 32) as "CwdMotorWindABTemp" ,
(max(T.CwdMotorWindBCTemp)* 1.8 + 32) as "CwdMotorWindBCTemp" ,
(max(T.CwdMotorWindCATemp)* 1.8 + 32) as "CwdMotorWindCATemp" ,
(max(T.PplRhtMtrMotorTemp)* 1.8 + 32) as "PplRhtMtrMotorTemp" ,
(max(T.PplRhtMtrMotorWindABTemp)* 1.8 + 32) as "PplRhtMtrMotorWindABTemp" ,
(max(T.PplRhtMtrMotorWindBCTemp)* 1.8 + 32) as "PplRhtMtrMotorWindBCTemp" ,
(max(T.PplRhtMtrMotorWindCATemp)* 1.8 + 32) as "PplRhtMtrMotorWindCATemp" ,
(max(T.SwgLFntMtrMotorTemp)* 1.8 + 32) as "SwgLFntMtrMotorTemp" ,
(max(T.SwgLFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindABTemp" ,
(max(T.SwgLFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindBCTemp" ,
(max(T.SwgLFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgLFntMtrMotorWindCATemp" ,
(max(T.HstRearMtrMotorTemp)* 1.8 + 32) as "HstRearMtrMotorTemp" ,
(max(T.HstRearMtrMotorWindABTemp)* 1.8 + 32) as "HstRearMtrMotorWindABTemp" ,
(max(T.HstRearMtrMotorWindBCTemp)* 1.8 + 32) as "HstRearMtrMotorWindBCTemp" ,
(max(T.HstRearMtrMotorWindCATemp)* 1.8 + 32) as "HstRearMtrMotorWindCATemp" ,
(max(T.PplLftMtrMotorTemp)* 1.8 + 32) as "PplLftMtrMotorTemp" ,
(max(T.PplLftMtrMotorWindABTemp)* 1.8 + 32) as "PplLftMtrMotorWindABTemp" ,
(max(T.PplLftMtrMotorWindBCTemp)* 1.8 + 32) as "PplLftMtrMotorWindBCTemp" ,
(max(T.PplLftMtrMotorWindCATemp)* 1.8 + 32) as "PplLftMtrMotorWindCATemp" ,
(max(T.SwgRFntMtrMotorTemp)* 1.8 + 32) as "SwgRFntMtrMotorTemp" ,
(max(T.SwgRFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindABTemp" ,
(max(T.SwgRFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindBCTemp" ,
(max(T.SwgRFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgRFntMtrMotorWindCATemp" ,
(max(T.HstFntMtrMotorTemp)* 1.8 + 32) as "HstFntMtrMotorTemp" ,
(max(T.HstFntMtrMotorWindABTemp)* 1.8 + 32) as "HstFntMtrMotorWindABTemp" ,
(max(T.HstFntMtrMotorWindBCTemp)* 1.8 + 32) as "HstFntMtrMotorWindBCTemp" ,
(max(T.HstFntMtrMotorWindCATemp)* 1.8 + 32) as "HstFntMtrMotorWindCATemp" ,
(max(T.SwgRearMtrMotorTemp)* 1.8 + 32) as "SwgRearMtrMotorTemp" ,
(max(T.SwgRearMtrMotorWindABTemp)* 1.8 + 32) as "SwgRearMtrMotorWindABTemp" ,
(max(T.SwgRearMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRearMtrMotorWindBCTemp" ,
(max(T.SwgRearMtrMotorWindCATemp)* 1.8 + 32) as "SwgRearMtrMotorWindCATemp" ,
(max(T.SwgFntMtrMotorTemp)* 1.8 + 32) as "SwgFntMtrMotorTemp" ,
(max(T.SwgFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgFntMtrMotorWindABTemp" ,
(max(T.SwgFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,
(max(T.SwgFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,
(max(T.ACS800Temp)* 1.8 + 32) as "ACS800Temp" ,
(max(T.TempDiffPhsU)* 1.8 + 32) as "TempDiffPhsU" ,
(max(T.TempDiffPhsV)* 1.8 + 32) as "TempDiffPhsV" ,
(max(T.TempDiffPhsW)* 1.8 + 32) as "TempDiffPhsW" ,
Max(T.DateTime) as "TemperatureTime"
FROM TempMtrScan T
JOIN Shovel S ON T.ShovelID = S.ID
WHERE (S.ID =@.ShovelID) AND T.DATETIME <= @.EndTime AND T.DATETIME >= @.StartTime
Group by ShovelID, datepart(yy,T.DateTime), datepart(dy,T.DateTime),datepart(hh,T.DateTime),datepart(mi,T.DateTime)/@.Duration
order by Max(T.DateTime) asc
(1943 row(s) affected)
Table 'Shovel'. Scan count 0, logical reads 2, physical reads 2, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'TempMtrScan'. Scan count 3, logical reads 38911, physical reads 493, read-ahead reads 736, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
Warning: Null value is eliminated by an aggregate or other SET operation.
First Time Installing - Can't Find BIDS
Thank you to all that take the time to read this!
All software is installed on a single development pc.I have a SQL Server 2000 Developer Edition Database that I am using to test a new Accounting System.SQL Server 2000 is the required format.I would like to start developing some SRSS reports against that database.It was suggested that I install the SQL Server 2005 Reporting Services, because I was told 2005 is less buggy and easier to use.I installed SRSS 2005, and only SRSS 2005, and used the Configuration Tool to get it configured properly, I think. I have green checks on everything except "Email Settings" and "Execution Account"
Now, I want to write some reports.BIDS is not under the "Microsoft SQL Server 2005" program group, only "Configuration Tools".I was also told that I could use Visual Studio to write reports.I installed Visual Studio 2005 Standard Edition.When I go start a new project, "Business Intelligence” is not a project type or sub-type.
What do I need to do so I can either install BIDS or use VS 2005 to write reports?
If you open Visual Studio 2005 and create a new project, do you see 'Business Intelligence Projects' as an available project type?
Jarret
|||BIDS is part of the SQL Server 2005 Workstation components and development tools - you'll need to go back and install that option in the installer.
Installing BIDS includes the SSRS support in Visual Studio. (BIDS actually is Visual Studio, just with little/no programming language support by default.)
|||Rup,
Thank you for the help! That was the problem.
First Time Installation of SQL Server 2005 Developer Edition
I get prompted with the following options..
This DVD contains 32-bit (x86) and 64-bit versions of this edition of SQL Server 2005. Click the link that matches your environment to begin
x86-based operating systems
x64-based operating systems
Itanuim-based operating syystems
I'm new to SQL Server... I just need to start learning how to use it... because it is being used at work... Don't need the all the features installed, just the normal table and query for the moment...
I will be installing it on my PC... i
Microsoft Windows XP - Home Edition - Version 2 - Service Pack 2
My local Hard Drive remaining capacity is 12.6GB
External Hard Drive remaining capacity is 11.0GB
Tried looking everywhere for the answer... lol (even looked at YouTube for a simple installation video...
Thanks for your helpWindowx XP Home Edition is a 32 bit operating system. You want the X86 code for use on XP Home Edition.
-PatP|||I'm new to SQL Server... I just need to start learning how to use it... because it is being used at work... Don't need the all the features installed, just the normal table and query for the moment...
As I only need to install the basic feature...
which one should i click?
SQL Server Database Services
Create a SQL Server fallover cluster
Analysus Services
Create an Analysis Server fallover cluster
Notification Services
Integration Services
Workstation components, Books Online development tools
Please help...|||On the Service Account section...
What should I click / Enter?
Username
Password
Domain
Under the... "Start Services at the end of setup" section, what should I tick?
SQL Server (tick already placed)
SQL Server Agent
SQL Brower
http://img.photobucket.com/albums/v675/akhlaq768/ServiceAccount.jpg
Many thanks
First Time Delay on client systems
Microsoft:
I've just set up a SQL Reporting Services server.
All seems to be working fine, however I've noticed that when a report is
opened from a user system accessing the report server for the first time, the
report takes a very long time to open (a few minutes in some cases), and
sometimes I have to abort it and start again.
This is a report that should take a couple of seconds at most. Once the
report does finally open, it opens fine from then on, even when refreshed, or
run by different parameters. Also all other reports availale to the user also
run fine after that first one finally opens.
There are no errors, just the Report is being generated message. It's like
the server has to get aquainted with the machine accessing it the first
time...
Again, once the report has run, this problem goes away. I have tested this
on around 10 different user systems, with the same results on all of them,
some are Win2k, some are XP. The report server is running on a dual
processor, clean install Server 2003, SQL Server 2000 sp 3a.
So far it appears to be machine, rather than user account, related...
Any assistance would be greatly appreciated. I'm holding off a full on roll
out of this until I get this solved, as it will certainly drive users crazy.
Thanks,
TomTHi Tomt,
Thanks for your posting!
From your descriptions, I understood that you would like to know why there
will be a delay (a few minutes in some cases) when you first time access
Reports. Have I understood you? Correct me if I was wrong.
Based on my konwledge, this is Reporting Services by design behavior. The
first user who runs the report with a unique region code creates a cached
report that contains data for that region. Subsequent users who request a
report using the same region code get the cached copy. create that report
will cost a lot of time.
The report server caches reports based on report execution options.
Execution options determine whether a report is cached and the length of
time it stays in cache. After some number of minutes or at a scheduled
time, the cache is emptied. The cache stays empty until a new report
execution operation occurs and a new copy of the report is cached.
Thank you for your patience and corporation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Michael,
I'm not sure what you mean by region code...
What I'm seeing is for example: I open a report on my system, which has
previously accessed the report server and experience no delay. I go to
another system, which has never accessed that server, and run the same
report, and get a delay of up to a few minutes.
Hope that is clear...
Thanks for your help,
Tom
"Michael Cheng [MSFT]" wrote:
> Hi Tomt,
> Thanks for your posting!
> From your descriptions, I understood that you would like to know why there
> will be a delay (a few minutes in some cases) when you first time access
> Reports. Have I understood you? Correct me if I was wrong.
> Based on my konwledge, this is Reporting Services by design behavior. The
> first user who runs the report with a unique region code creates a cached
> report that contains data for that region. Subsequent users who request a
> report using the same region code get the cached copy. create that report
> will cost a lot of time.
> The report server caches reports based on report execution options.
> Execution options determine whether a report is cached and the length of
> time it stays in cache. After some number of minutes or at a scheduled
> time, the cache is emptied. The cache stays empty until a new report
> execution operation occurs and a new copy of the report is cached.
> Thank you for your patience and corporation. If you have any questions or
> concerns, don't hesitate to let me know. We are always here to be of
> assistance!
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||I'm sure he meant report query parameters and region code was the specific
one in his head for an example.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"TomT" <tomt@.newsgroup.nospam> wrote in message
news:FC1995F8-D81D-4049-87EC-4B88A4DDB8BB@.microsoft.com...
> Michael,
> I'm not sure what you mean by region code...
> What I'm seeing is for example: I open a report on my system, which has
> previously accessed the report server and experience no delay. I go to
> another system, which has never accessed that server, and run the same
> report, and get a delay of up to a few minutes.
> Hope that is clear...
> Thanks for your help,
> Tom
> "Michael Cheng [MSFT]" wrote:
>> Hi Tomt,
>> Thanks for your posting!
>> From your descriptions, I understood that you would like to know why
>> there
>> will be a delay (a few minutes in some cases) when you first time access
>> Reports. Have I understood you? Correct me if I was wrong.
>> Based on my konwledge, this is Reporting Services by design behavior. The
>> first user who runs the report with a unique region code creates a cached
>> report that contains data for that region. Subsequent users who request a
>> report using the same region code get the cached copy. create that report
>> will cost a lot of time.
>> The report server caches reports based on report execution options.
>> Execution options determine whether a report is cached and the length of
>> time it stays in cache. After some number of minutes or at a scheduled
>> time, the cache is emptied. The cache stays empty until a new report
>> execution operation occurs and a new copy of the report is cached.
>> Thank you for your patience and corporation. If you have any questions or
>> concerns, don't hesitate to let me know. We are always here to be of
>> assistance!
>>
>> Sincerely yours,
>> Michael Cheng
>> Microsoft Online Partner Support
>> When responding to posts, please "Reply to Group" via your newsreader so
>> that others may learn and benefit from your issue.
>> =====================================================>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>|||Ok, thanks. If that is the case, that is not the situation I'm talking about,
it seems to be related to whether or not a system has ever accessed the
server at all, there are no delays on systems that have, regardless of
parameters.
Thanks
"Jeff A. Stucker" wrote:
> I'm sure he meant report query parameters and region code was the specific
> one in his head for an example.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "TomT" <tomt@.newsgroup.nospam> wrote in message
> news:FC1995F8-D81D-4049-87EC-4B88A4DDB8BB@.microsoft.com...
> > Michael,
> >
> > I'm not sure what you mean by region code...
> >
> > What I'm seeing is for example: I open a report on my system, which has
> > previously accessed the report server and experience no delay. I go to
> > another system, which has never accessed that server, and run the same
> > report, and get a delay of up to a few minutes.
> >
> > Hope that is clear...
> >
> > Thanks for your help,
> >
> > Tom
> >
> > "Michael Cheng [MSFT]" wrote:
> >
> >> Hi Tomt,
> >>
> >> Thanks for your posting!
> >>
> >> From your descriptions, I understood that you would like to know why
> >> there
> >> will be a delay (a few minutes in some cases) when you first time access
> >> Reports. Have I understood you? Correct me if I was wrong.
> >>
> >> Based on my konwledge, this is Reporting Services by design behavior. The
> >> first user who runs the report with a unique region code creates a cached
> >> report that contains data for that region. Subsequent users who request a
> >> report using the same region code get the cached copy. create that report
> >> will cost a lot of time.
> >>
> >> The report server caches reports based on report execution options.
> >> Execution options determine whether a report is cached and the length of
> >> time it stays in cache. After some number of minutes or at a scheduled
> >> time, the cache is emptied. The cache stays empty until a new report
> >> execution operation occurs and a new copy of the report is cached.
> >>
> >> Thank you for your patience and corporation. If you have any questions or
> >> concerns, don't hesitate to let me know. We are always here to be of
> >> assistance!
> >>
> >>
> >> Sincerely yours,
> >>
> >> Michael Cheng
> >> Microsoft Online Partner Support
> >>
> >> When responding to posts, please "Reply to Group" via your newsreader so
> >> that others may learn and benefit from your issue.
> >> =====================================================> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
>
>|||Look for an earlier thread on this topic. Bruce and others have invented a
keep-alive type solution that periodically runs a trivial report on schedule
to keep the process from unloading.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"TomT" <tomt@.newsgroup.nospam> wrote in message
news:FACEA9F4-41FE-4C02-AD27-8FB118FB73AB@.microsoft.com...
> Ok, thanks. If that is the case, that is not the situation I'm talking
> about,
> it seems to be related to whether or not a system has ever accessed the
> server at all, there are no delays on systems that have, regardless of
> parameters.
> Thanks
> "Jeff A. Stucker" wrote:
>> I'm sure he meant report query parameters and region code was the
>> specific
>> one in his head for an example.
>> --
>> Cheers,
>> '(' Jeff A. Stucker
>> \
>> Business Intelligence
>> www.criadvantage.com
>> ---
>> "TomT" <tomt@.newsgroup.nospam> wrote in message
>> news:FC1995F8-D81D-4049-87EC-4B88A4DDB8BB@.microsoft.com...
>> > Michael,
>> >
>> > I'm not sure what you mean by region code...
>> >
>> > What I'm seeing is for example: I open a report on my system, which has
>> > previously accessed the report server and experience no delay. I go to
>> > another system, which has never accessed that server, and run the same
>> > report, and get a delay of up to a few minutes.
>> >
>> > Hope that is clear...
>> >
>> > Thanks for your help,
>> >
>> > Tom
>> >
>> > "Michael Cheng [MSFT]" wrote:
>> >
>> >> Hi Tomt,
>> >>
>> >> Thanks for your posting!
>> >>
>> >> From your descriptions, I understood that you would like to know why
>> >> there
>> >> will be a delay (a few minutes in some cases) when you first time
>> >> access
>> >> Reports. Have I understood you? Correct me if I was wrong.
>> >>
>> >> Based on my konwledge, this is Reporting Services by design behavior.
>> >> The
>> >> first user who runs the report with a unique region code creates a
>> >> cached
>> >> report that contains data for that region. Subsequent users who
>> >> request a
>> >> report using the same region code get the cached copy. create that
>> >> report
>> >> will cost a lot of time.
>> >>
>> >> The report server caches reports based on report execution options.
>> >> Execution options determine whether a report is cached and the length
>> >> of
>> >> time it stays in cache. After some number of minutes or at a scheduled
>> >> time, the cache is emptied. The cache stays empty until a new report
>> >> execution operation occurs and a new copy of the report is cached.
>> >>
>> >> Thank you for your patience and corporation. If you have any questions
>> >> or
>> >> concerns, don't hesitate to let me know. We are always here to be of
>> >> assistance!
>> >>
>> >>
>> >> Sincerely yours,
>> >>
>> >> Michael Cheng
>> >> Microsoft Online Partner Support
>> >>
>> >> When responding to posts, please "Reply to Group" via your newsreader
>> >> so
>> >> that others may learn and benefit from your issue.
>> >> =====================================================>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>>|||Thanks Jeff, that was my thread, I believe, which I started over because of
profile issues - and to get MS involved.
Unfortunately, that solution is not applicable to the problem I am
describing, apparently not very well...:-)
Here's a clearer scenario (I hope): I run report A on my system, it opens
immediately (my system has run reports previously, not necessarily report A,
however).
I goimmediately to another system , which has never run any reports at all,
and run report A. In many (although not all) cases, minutes will pass before
the report processing is competed. Since the time between running the report
on one system and the other is miniscule, I don't think the process is
unloading - there appears to be something else going on...
"Jeff A. Stucker" wrote:
> Look for an earlier thread on this topic. Bruce and others have invented a
> keep-alive type solution that periodically runs a trivial report on schedule
> to keep the process from unloading.
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "TomT" <tomt@.newsgroup.nospam> wrote in message
> news:FACEA9F4-41FE-4C02-AD27-8FB118FB73AB@.microsoft.com...
> > Ok, thanks. If that is the case, that is not the situation I'm talking
> > about,
> > it seems to be related to whether or not a system has ever accessed the
> > server at all, there are no delays on systems that have, regardless of
> > parameters.
> >
> > Thanks
> >
> > "Jeff A. Stucker" wrote:
> >
> >> I'm sure he meant report query parameters and region code was the
> >> specific
> >> one in his head for an example.
> >>
> >> --
> >> Cheers,
> >>
> >> '(' Jeff A. Stucker
> >> \
> >>
> >> Business Intelligence
> >> www.criadvantage.com
> >> ---
> >> "TomT" <tomt@.newsgroup.nospam> wrote in message
> >> news:FC1995F8-D81D-4049-87EC-4B88A4DDB8BB@.microsoft.com...
> >> > Michael,
> >> >
> >> > I'm not sure what you mean by region code...
> >> >
> >> > What I'm seeing is for example: I open a report on my system, which has
> >> > previously accessed the report server and experience no delay. I go to
> >> > another system, which has never accessed that server, and run the same
> >> > report, and get a delay of up to a few minutes.
> >> >
> >> > Hope that is clear...
> >> >
> >> > Thanks for your help,
> >> >
> >> > Tom
> >> >
> >> > "Michael Cheng [MSFT]" wrote:
> >> >
> >> >> Hi Tomt,
> >> >>
> >> >> Thanks for your posting!
> >> >>
> >> >> From your descriptions, I understood that you would like to know why
> >> >> there
> >> >> will be a delay (a few minutes in some cases) when you first time
> >> >> access
> >> >> Reports. Have I understood you? Correct me if I was wrong.
> >> >>
> >> >> Based on my konwledge, this is Reporting Services by design behavior.
> >> >> The
> >> >> first user who runs the report with a unique region code creates a
> >> >> cached
> >> >> report that contains data for that region. Subsequent users who
> >> >> request a
> >> >> report using the same region code get the cached copy. create that
> >> >> report
> >> >> will cost a lot of time.
> >> >>
> >> >> The report server caches reports based on report execution options.
> >> >> Execution options determine whether a report is cached and the length
> >> >> of
> >> >> time it stays in cache. After some number of minutes or at a scheduled
> >> >> time, the cache is emptied. The cache stays empty until a new report
> >> >> execution operation occurs and a new copy of the report is cached.
> >> >>
> >> >> Thank you for your patience and corporation. If you have any questions
> >> >> or
> >> >> concerns, don't hesitate to let me know. We are always here to be of
> >> >> assistance!
> >> >>
> >> >>
> >> >> Sincerely yours,
> >> >>
> >> >> Michael Cheng
> >> >> Microsoft Online Partner Support
> >> >>
> >> >> When responding to posts, please "Reply to Group" via your newsreader
> >> >> so
> >> >> that others may learn and benefit from your issue.
> >> >> =====================================================> >> >> This posting is provided "AS IS" with no warranties, and confers no
> >> >> rights.
> >> >>
> >> >>
> >>
> >>
> >>
>
>|||Hi Tom,
What kind of credentials are used against the datasource?
Each IE and IIS do some hand shaking on the first request. It is also
possible that domain authentication or the first connection to the data
source lead to this kind of delay.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Michael,
Thanks for your response. It does appear to be related to the user. I logged
onto a system which had never accessed the report server, and got the report
right away. I then had another person log on to the same machine, and he got
a delay.
I am using a shared data source to access the actual sql server data, so
that is common to everyone, in other words the authentication for the reports
to the sql server data is not specific to individual users, their credentials
are not used.
I wonder if the IIS server (which is the same machine as the Report Server)
is a factor in the delay? People can get to the server without delays, it
just happens when they run their first report...
"Michael Cheng [MSFT]" wrote:
> Hi Tom,
> What kind of credentials are used against the datasource?
> Each IE and IIS do some hand shaking on the first request. It is also
> possible that domain authentication or the first connection to the data
> source lead to this kind of delay.
>
> Sincerely yours,
> Michael Cheng
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>