Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Problem with running stored procedure

Author  Topic 

gamaz2
Starting Member

31 Posts

Posted - 2008-11-17 : 10:37:57
Hi,
I have a system stored procedure from sql server 2005 environment that needs to be run in sql server 2000 environment. While trying to do so I am getting the following error
Server: Msg 170, Level 15, State 1, Procedure sp_addextendedproperty, Line 37
Line 37: Incorrect syntax near '%'.


I cannot figure out what is the source of the error. Any help is appreciated.

STORED PROCEDURE:

create procedure sys.sp_addextendedproperty
@name sysname,
@value sql_variant = NULL,
@level0type varchar(128) = NULL,
@level0name sysname = NULL,
@level1type varchar(128) = NULL,
@level1name sysname = NULL,
@level2type varchar(128) = NULL,
@level2name sysname = NULL
as

declare @ret int

if datalength(@value) > 7500
begin
raiserror(15097,-1,-1)
return 1
end

if @name is null
begin
raiserror(15600,-1,-1,'sp_addextendedproperty')
return (1)
end

execute @ret = sys.sp_validname @name
if (@ret <> 0)
begin
raiserror(15600,-1,-1,'sp_addextendedproperty')
return (1)
end


BEGIN TRANSACTION

begin
EXEC %%ExtendedPropertySet().AddValue(Name = @name, Value = @value, Level0type = @level0type, Level0name = @level0name, Level1type = @level1type, Level1name = @level1name, Level2type = @level2type, Level2name = @level2name)
IF @@error <> 0
begin
COMMIT TRANSACTION
return (1)
end
end

COMMIT TRANSACTION
return (0)

SimpleSQL
Yak Posting Veteran

85 Posts

Posted - 2008-11-19 : 21:53:51
This is because this SP is more than likely supported by some code in SQL 2005 which is not present in SQL 2000.
Go to Top of Page
   

- Advertisement -