Friday, March 9, 2012

Script error

Hello,
I=B4ve done one script where i verify the sql server version and the output return the corresponding collations. First is checked if the version is "SQL Server 7.0" and if it is executes sp_helpsort, if it isn=B4t SQL 7.0 there are a lot of steps and one query where is referenced the serverproperty('collation').
The problem is that im trying this and the following error is returned:
"Server: Msg 195, Level 15, State 10, Line 2
'serverproperty' is not a recognized function name"
but if i comment the query the script runs without any problem.
How is this possible? It should not be possible that this part of the script were checked since the @.@.version of the server is 7.0 and so theres no nedd to check the else statement
I cant understand, down i write a coople of lines used in the script.
if (select substring(@.@.version,1,23)) =3D 'Microsoft SQL Server 7'
begin
exec sp_helpsort end
else
begin
.
.
.
select [Server Name] =3D @.@.servername, [Server Default Collation] =3D convert(char
(50),serverproperty('collation')) end
Hope that you can help me
RegardsThe serverproperty function is only available in 2000 if I'm not mistaken. SP_server_info will return the collation under 7.0.
>--Original Message--
>Hello,
>I=B4ve done one script where i verify the sql server version >and the output return the corresponding collations. First >is checked if the version is "SQL Server 7.0" and if it is >executes sp_helpsort, if it isn=B4t SQL 7.0 there are a lot >of steps and one query where is referenced the >serverproperty('collation').
>The problem is that im trying this and the following error >is returned:
>"Server: Msg 195, Level 15, State 10, Line 2
>'serverproperty' is not a recognized function name"
>but if i comment the query the script runs without any >problem.
>How is this possible? >It should not be possible that this part of the script >were checked since the @.@.version of the server is 7.0 and >so theres no nedd to check the else statement
>I cant understand, down i write a coople of lines used in >the script.
>if (select substring(@.@.version,1,23)) =3D 'Microsoft SQL >Server 7'
> begin
> exec sp_helpsort > end
>else
> begin
> .
> .
> .
> select [Server Name] =3D @.@.servername, > [Server Default Collation] =3D convert(char
>(50),serverproperty('collation')) > end
>Hope that you can help me
>Regards
>.
>

No comments:

Post a Comment