Skip to Content
0
Oct 16, 2009 at 07:50 AM

Applying failure

24 Views

Hi Experts,

We are trying to apply this following function in MS SQL 2000 SP4:

USE [DB1]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date, ,>
-- Description:	<Description, ,>
-- =============================================
ALTER FUNCTION [dbo].[@DEF_XLL]
(
	-- Add the parameters for the function here
	@Val nvarchar(MAX),
	@PadChar nvarchar(1),
	@Length int
)
RETURNS nvarchar(MAX)
AS
BEGIN
 
	-- Return the result of the function
	RETURN replicate(@PadChar,@Length-len(@Val)) + @Val
 
END

but it failed. The error message is "incorrect syntax near returns. Must declare the variable '@Padchar'. Pls give adv. Thx

Rgd,

Steve