Thursday, March 22, 2012
_WA Statistics Error
We have had a problem with a table recently where a load had stopped half
with through with an index problem.
After a bit of delving the problem seems to be causes by the system created
Statisitcs for a particial index or at least thats where the error message i
s
pointing to.
The database is set to auto update the statistics and we use this table to
do a lot of loads, truncates and deletes.
My question is this, has anyone seen a problem created by the System created
statisitics and what was the fix.
TIA
PatriciaParticia
What's version are you using?
Havu you ran DBCC SHOW_STATISTICS?
Also take a look at sp_createstats system stored procedure
"Patricia" <Patricia@.discussions.microsoft.com> wrote in message
news:2E80BF08-3146-4749-8142-CC7A7BC1F56D@.microsoft.com...
> Hello,
> We have had a problem with a table recently where a load had stopped half
> with through with an index problem.
> After a bit of delving the problem seems to be causes by the system
> created
> Statisitcs for a particial index or at least thats where the error message
> is
> pointing to.
> The database is set to auto update the statistics and we use this table to
> do a lot of loads, truncates and deletes.
> My question is this, has anyone seen a problem created by the System
> created
> statisitics and what was the fix.
> TIA
> Patricia
_WA Statistics Error
We have had a problem with a table recently where a load had stopped half
with through with an index problem.
After a bit of delving the problem seems to be causes by the system created
Statisitcs for a particial index or at least thats where the error message is
pointing to.
The database is set to auto update the statistics and we use this table to
do a lot of loads, truncates and deletes.
My question is this, has anyone seen a problem created by the System created
statisitics and what was the fix.
TIA
PatriciaParticia
What's version are you using?
Havu you ran DBCC SHOW_STATISTICS?
Also take a look at sp_createstats system stored procedure
"Patricia" <Patricia@.discussions.microsoft.com> wrote in message
news:2E80BF08-3146-4749-8142-CC7A7BC1F56D@.microsoft.com...
> Hello,
> We have had a problem with a table recently where a load had stopped half
> with through with an index problem.
> After a bit of delving the problem seems to be causes by the system
> created
> Statisitcs for a particial index or at least thats where the error message
> is
> pointing to.
> The database is set to auto update the statistics and we use this table to
> do a lot of loads, truncates and deletes.
> My question is this, has anyone seen a problem created by the System
> created
> statisitics and what was the fix.
> TIA
> Patricia
Tuesday, March 20, 2012
[SS2K5] : Populate a CTE from stored procedure result set
Hi,
I'd like to know if it's possible to populate/load a CTE from a stored procedure result set ?
Kind of :
USE MyDB;
GO
WITH MyCTE (Col1, Col2, Col3)
AS
(
EXECUTE myStoredProc
)
SELECT *
FROM MyCTE
GO
Thanks for your help.
Cheers,
Bertrand
A couple of options include loading your stored procedure output to a temp table:
INSERT NTO #aTempTable
EXEC yourStoredProcedure
and also converting your procedure into an function or perhaps a view and then you can join to the function or view. If the primary objective of the stored procedure is to be used as you describe it might be best from the outset to consider converting it into a function.
But also keep in mind that in many cases the temp table / stored procedure option will outperform the function.
|||CTE in SQL Server 2005 is just syntactic sugar. It is similar to view in that the query expression of the CTE is parsed into the original query, compiled, optimized and executed. So there is no special optimization in terms of storing intermediate results in case of multiple references to the same CTE and so on. So you have few options:
1. Convert the SP to inline TVF - best performance
2. Convert the SP logic to a view
3. Convert the SP to non-inline TVF
4. Use a temporary table to store results from SP and reuse it
|||
Well in fact I have to perform a row by row operation on the sp result set. Which means using a cursor. And I know that using a cursor with a temporay table is not the best in term of performance so I thought that CTE was the best option...
But your first option could fits for my problem.
Thanks for your guidance.
|||What kind of row by row operation are you performing?|||
Well in fact I received a result set from one stored procedure. Each column in this result set become input parameters for an other stored proc I have to call.
It could be more "easy" if I had the right to modifiy the both of these stored proc but I'm not allowed to and I just can to plug my logic between these sp ....
Monday, March 19, 2012
[SQL Serevr 2005 Express] Loading data from an Excel sheet
Hi,
Is it possible to load data from an Excel sheet column, into a DB column within SQL Server Express Edition? I'm able to copy data from the DB talbe column into the Excel sheet, but not the other way, which forces me to enter data row by row, manually.
Thanks,
Alon
I describe one way I can do:
Create your table with the datastructure you want from VWD IDE for your batabase in the App_Data folder.
1.Select data from your excel columns and copy.
2.Open your table, highlight one blank row, right-click the highlighted area, from the manu select paste.
You already know how to copy data from SQL2005 Express to excel. It is sort of the same thing.
You may need to watch your column datatype.
|||
Hi limno,
Thanks for the detailed answer.
I tried it before, but unfortunately VWD doesn't support Paste of multiple cells. This means that if you'll copy several cells (within 1 column) from the Excel sheet, and try to paste it in the DB table (in VWD), as you described in step #2, you'll notice that only 1 cell, the one you highlighted, is affected.
This is, unless I'm missing something very basic...
Thanks,
Alon
You paste over the highlighted row. That means all clomns in your table are highlighted.
If you highlight only one cell, it is true that everything goes in that cell.
Hope this helps.