Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP - what is wrong with this syntax? 1

Status
Not open for further replies.

takaoki

Programmer
Aug 28, 2008
39
ZA
Hi,

Keep getting this error msg:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'ON'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

When I try to do this:

CREATE STATISTICS ON myTable WITH FULLSCAN

This is the correct syntax, yes?

Thanks
 
Try...

Code:
CREATE STATISTICS [!]myStatisticsName[/!] ON myTable WITH FULLSCAN

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Yes, that works... but interestingly, I was having the same syntax error with "UPDATE STATS", except in BOL it doesn't mention having to name the stats

My additional problem now is, in spite of the fact that I've created the stats for the table, I'm still getting a "Columns With No Statistics" warning in my execution plan. I want to get rid of this... but the create stats did not do it. I also dropped and recreated the index (which contains the column referenced by the warning), but no dice.

 
Clearly, you must be having performance problems with a particular query. Have you tried creating a covering index for it?


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Yeah, we're definitely having performance problems at the moment.

But I don't understand why I'm seeing the "Columns With No Statistics" warning in the execution plan since I *just* did a UPDATE STATS on the entire database with FULLSCAN via a maintenance plan. I've never seen this warning before actually.

Also, the column that it's warning me about IS in a covering index on the table... so it doesn't make sense to me.

Seems buggy. Any other possible ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top