Phil,
Here is a much simpler function.
ALTER FUNCTION [dbo].[fnConvertTabToSpaces]
(
@String VARCHAR(8000)
,@NumSpaces INT
)
RETURNS VARCHAR(8000)
AS
BEGIN
-- Declare the return variable here
DECLARE
@Result VARCHAR(8000)
,@tab CHAR(1) = CHAR(09)
SELECT
@Result = REPLACE(@String, @tab, SPACE(@NumSpaces))
RETURN @Result
END
Bill Soranno
MCP, MCTS, MCITP DBA
Database Administrator
Winona State University
Maxwell 143
"Quality, like Success, is a Journey, not a Destination" - William Soranno '92