I have a stored procedure that contains a table variable.
Declare @.xxxx table
(columname columtype)
In the stored procedure there is a select against the table variable after
it has rows inserted into it. When the stored procedure is called via .Net
code, we are seeing in Profiler 208 errors. When I run the stored procedure
in Query Analyzer no errors show up. But when I do a show execution plan in
Query Analyzer, I see the plan for the select against the table variable has
the table scan in RED. When I place the cursor over the table scan it says
that the "Warning: Statistics missing for this table. Choose 'Create Missin
g
Statistics' from the contents (Right click) menu". If I try to do that I ge
t
an error saying missing object to create statistics on, which of course make
s
perfect sense.
If I change the table variable to a temporary table, the warning goes away,
but we are not sure about the 208 error just yet as I still have to have the
developers call a different stored proc to test it.
I would prefer to not change the table variables to temporary tables since
in these cases we have chosen table variables because no index was needed fo
r
speed.
NOTE: Not all of the table variables in the same stored procedure is having
the missing statistics showing up in the query execution plan.
I would appreciate any help from anyone else who has seen this before.
Thanks
LeAnneTable variables do not amntain statistics like temporary tables can.
INF: Frequently Asked Questions - SQL Server 2000 - Table Variables
http://support.microsoft.com/defaul...7&Product=sql2k
AMB
"LeAnne Jergensen" wrote:
> I have a stored procedure that contains a table variable.
> Declare @.xxxx table
> (columname columtype)
> In the stored procedure there is a select against the table variable after
> it has rows inserted into it. When the stored procedure is called via .Ne
t
> code, we are seeing in Profiler 208 errors. When I run the stored procedu
re
> in Query Analyzer no errors show up. But when I do a show execution plan
in
> Query Analyzer, I see the plan for the select against the table variable h
as
> the table scan in RED. When I place the cursor over the table scan it say
s
> that the "Warning: Statistics missing for this table. Choose 'Create Miss
ing
> Statistics' from the contents (Right click) menu". If I try to do that I
get
> an error saying missing object to create statistics on, which of course ma
kes
> perfect sense.
> If I change the table variable to a temporary table, the warning goes away
,
> but we are not sure about the 208 error just yet as I still have to have t
he
> developers call a different stored proc to test it.
> I would prefer to not change the table variables to temporary tables since
> in these cases we have chosen table variables because no index was needed
for
> speed.
> NOTE: Not all of the table variables in the same stored procedure is havin
g
> the missing statistics showing up in the query execution plan.
>
> I would appreciate any help from anyone else who has seen this before.
> Thanks
> LeAnne|||I know that table variables do not have stats. That is why I am so
:
1. Why is the explain plan showing that the stats are missing on something
they can not even exist on. Seems like a bug to me.
2. Why the Error 208 is generated on a table variable having missing stats
when they can not have stats to begin with. Seems like another bug to me.
Is anyone else seeing this or know if there is a bug that is going to be
fixed?
"Alejandro Mesa" wrote:
> Table variables do not amntain statistics like temporary tables can.
> INF: Frequently Asked Questions - SQL Server 2000 - Table Variables
> [url]http://support.microsoft.com/default.aspx?scid=kb;en-us;305977&Product=sql2k[/ur
l]
>
> AMB
> "LeAnne Jergensen" wrote:
>
Sunday, February 19, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment