SELECT @sql = (SELECT dbo.CRF_Project.DocStatus from vsCustomizationRequest.dbo.CRF_Project where CustomerID = '1') --this is the result returned from a table --loop start here IF(@sql = '0') SET @row = CONVERT(INT,(COUNT(@sql))) SET @ColumnName = 'sta0' SET @statement = 'UPDATE ['+@TABLE+'] SET '+@ColumnName+' = '''+@row+'''' EXEC @statement
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)