You are here: Re: Inserting dummy lines and padding « MsSQL Server « IT news, forums, messages
Re: Inserting dummy lines and padding

Posted by jim_geissman on 09/26/59 11:33

This seems to work for the header, assuming you can figure out which is
the first line (minimum StockID) --

CREATE TABLE #Test(N int IDENTITY, String varchar(30))
INSERT #Test SELECT 'Line one'
INSERT #Test SELECT 'Line two'

DECLARE C CURSOR FOR SELECT
Head=CASE WHEN N=1
THEN 'Header'+CHAR(10)+String
ELSE String END FROM #Test
DECLARE @String varchar(30)
OPEN C
WHILE 1=1 BEGIN
FETCH NEXT FROM C INTO @String
IF @@FETCH_STATUS <> 0 BREAK
PRINT @String
END
CLOSE C
DEALLOCATE C

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация