DECLARE @code varchar (10)
DECLARE @codeTable table (SEC_CD char(6))
DECLARE @i int
set @i=0
WHILE (@i<100)
BEGIN
SET @i=@i+1
SET @code=''
EXEC master.dbo.xp_sscanf @codes, '%s ', @code OUTPUT
SET @codes=LTRIM(REPLACE(@codes, @code, ''))
SET @codes=REPLACE(@codes, @code+char(13)+char(10), '')
--SELECT @codes, @code
IF @code is not null AND LEN(@code)=6
insert into @codeTable (sec_cd) values (@code)
IF LTRIM(@codes) is null OR LTRIM(@codes) ='' OR @code is null
BREAK
END