
declare @ColumnCount int;
declare @ListeColumn varchar(8000);
declare @ListeSelect varchar(8000);
set @ColumnCount = 0
set @ListeColumn = ''
set @ListeSelect = ''
while (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'MEMBRE') > @ColumnCount
	begin
		set @ColumnCount = @ColumnCount + 1
		if (COLUMNPROPERTY(OBJECT_ID('MEMBRE'),COL_NAME(OBJECT_ID('MEMBRE'), @ColumnCount),'IsIdentity') = 0)
			begin
				set @ListeColumn = @ListeColumn + (select (COL_NAME(OBJECT_ID('MEMBRE'), @ColumnCount)))
				set @ListeSelect = @ListeSelect + 'convert (varchar(8000),'
				set @ListeSelect = @ListeSelect + (select (COL_NAME(OBJECT_ID('MEMBRE'), @ColumnCount)))
					if (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'MEMBRE') > @ColumnCount
						begin
							set @ListeColumn = @ListeColumn + ','
							set @ListeSelect = @ListeSelect + ')'+'+'''''' , ''''''+'
						end
					if (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'MEMBRE') = @ColumnCount
						begin
							set @ListeSelect = @ListeSelect + ')'
						end
			end
	end

declare @VSelect varchar (8000)
declare @VPrinting varchar (8000)
declare @TmpTable table (
Column1 varchar(8000)
)
set @VSelect = 'select '+@ListeSelect+' from membre'

insert into @TmpTable (Column1)
exec (@VSelect)

Declare curseur_print cursor for
select Column1 from @TmpTable
open curseur_print;
fetch next from curseur_print into @VPrinting
Print '--------------------------------------------'
Print '--'
Print '--'
Print '-- Inserts de la Table Membre'
Print '--'
Print '--'
Print '--------------------------------------------'
Print ''
while (@@fetch_status = 0)
	begin
		Print 'INSERT INTO [MEMBRE] ('+@ListeColumn+')'
		Print 'VALUES ('''+@VPrinting+''')'
		Print 'GO'
		Print ' '
		fetch next from curseur_print into @VPrinting
	end
close curseur_print;
deallocate curseur_print;
