, SQL:
. , , , . , sql.:
SQL :
DECLARE @sql as varchar(max)
, , SQL, , . :
declare @sqlcounter as int
declare @listofvariables as varchar(500)
set @sqlcounter =1
while sqlCounter <= 12
BEGIN
set @listofvariables = @listofvariables + 'BLOC' + @SqlCounter +', '
set @sqlCounter = @sqlCounter + 1
END
set @sql = 'select ' + @listofvariables + ' FROM tablename'
EXEC @SQL
, , , SQL .
SQL :
SELECT BLOC1, BLOC2, BLOC3, BLOC4, BLOC5, BLOC6, BLOC7, BLOC8, BLOC9, BLOC10, BLOC11, BLOC12 FROM tablename
, !