August 11, 2005 at 1:04 pm
may I ask what SP level is your server running?
select serverproperty('ProductVersion'),serverproperty('ProductLevel')
* Noel
August 11, 2005 at 1:07 pm
That fails too... that's why we're all stumped :
use finance
select TOP 10 *
from sysobjects
Results:Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '10'.
use pubs
select TOP 10 *
from sysobjects
August 11, 2005 at 1:24 pm
tried it with the order by ..still get the error.
August 11, 2005 at 1:27 pm
Well that does work. But, what I was tryig to do was something like this
create my_view
as
select top 100 percent *
from my_table
order by column1
This way view is pre sorted, since you can not have just an order by within a view.
Jersey
August 11, 2005 at 1:29 pm
8.00.194 RTM
was the result
August 11, 2005 at 1:56 pm
yep order by works just fine.
August 11, 2005 at 2:00 pm
RTM = Release To Manufacture.
You have the original retail version of SQL server installed you need to at least go to SP3a or SP4 if you can!!!
Cheers!
* Noel
August 11, 2005 at 2:34 pm
Hmmm I was under the impression that the service packs had been installed.
Thanks for pointing that out. I think the datacenter has some explaining to do!
August 11, 2005 at 3:56 pm
Sorry for me to be the bad news bearer
But is is really important that you patch that server ASAP
* Noel
August 11, 2005 at 4:57 pm
I think that it's an understatement. Time to use the word needs to be done last year .
August 12, 2005 at 6:42 am
Update your service pack to at least SP3a and make sure your SA account has a strong password. Then retry your script.
-SQLBill
August 12, 2005 at 8:05 am
No its a good catch. I was under the impression that service pack 3a had been applied during a recent server upgrade project. Turns out that because my then server admin was sacked by HR, he never gave the instructions to the new admin.
Well that life in the corp world today.
Thanks for all the feed back.
--JerseyMo
August 12, 2005 at 8:10 am
Not quite true. TOP keyword is SQL7 (level 70) onwards only and the error is a symptom of compatabilty albeit the poster says it is not.
Remi, your code works because of the way sp_dbcmptlevel works
sp_dbcmptlevel affects the behaviors in the specified database, not the entire server. The compatibility setting for a database takes effect when the database is made the current database with the USE statement, or if the database is the default database for the login. When a stored procedure is executed, the current compatibility level of the database in which the procedure is defined is used. All stored procedures in the database are recompiled when the compatibility setting is changed in that database.
If you put batch separator (GO) after each exec sp_dbcmptlevel then you will see an error
Far away is close at hand in the images of elsewhere.
Anon.
August 12, 2005 at 8:22 am
Wow, thanx for the tip. Here's the corrected version and results :
create database test
use test
exec sp_dbcmptlevel 'Test', 80
GO
exec sp_dbcmptlevel 'Test'
Select top 10 * from dbo.SysObjects
--no error given
exec sp_dbcmptlevel 'Test', 70
GO
exec sp_dbcmptlevel 'Test'
Select top 10 * from dbo.SysObjects
--no error given
exec sp_dbcmptlevel 'Test', 65
GO
exec sp_dbcmptlevel 'Test'
Select top 10 * from dbo.SysObjects
--FAILS
exec sp_dbcmptlevel 'Test', 60
GO
exec sp_dbcmptlevel 'Test'
Select top 10 * from dbo.SysObjects
--FAILS
/*
use master
drop database test
*/
August 12, 2005 at 8:28 am
Thats it. I adjusted the comp level and its working.
Now this opens the disscusion of what are the potential gottcha's.
Viewing 15 posts - 16 through 30 (of 34 total)
You must be logged in to reply to this topic. Login to reply