diff --git a/sql/tSQLt_synapse/StoredProcedures/AssertEmptyTable.sql b/sql/tSQLt_synapse/StoredProcedures/AssertEmptyTable.sql index 1332429..5f2e5e5 100644 --- a/sql/tSQLt_synapse/StoredProcedures/AssertEmptyTable.sql +++ b/sql/tSQLt_synapse/StoredProcedures/AssertEmptyTable.sql @@ -29,11 +29,8 @@ BEGIN END ELSE BEGIN - PRINT 'EXECUTING AssertEmptyTable' DECLARE @table_name_without_schema NVARCHAR(MAX) = OBJECT_NAME(OBJECT_ID(@table_name)); - DECLARE @schema_name NVARCHAR(MAX) = OBJECT_NAME(OBJECT_ID(@table_name)); - PRINT 'schema_name: ' + @schema_name - PRINT 'table_name_without_schema: ' + @table_name_without_schema + DECLARE @schema_name NVARCHAR(MAX) = OBJECT_SCHEMA_NAME(OBJECT_ID(@table_name)); EXEC [tSQLt_synapse].[Private_PrintTable] @schema_name, @table_name_without_schema; END DECLARE @message NVARCHAR(MAX); diff --git a/sql/tSQLt_synapse/StoredProcedures/Private_CompareTables.sql b/sql/tSQLt_synapse/StoredProcedures/Private_CompareTables.sql index b43c963..dadf272 100644 --- a/sql/tSQLt_synapse/StoredProcedures/Private_CompareTables.sql +++ b/sql/tSQLt_synapse/StoredProcedures/Private_CompareTables.sql @@ -61,9 +61,7 @@ BEGIN IF @UnequalRowsExist > 0 BEGIN - PRINT 'EXECUTING CompareTables' EXEC [tSQLt_synapse].[Private_PrintTable] @ResultTableSchema, @ResultTable; - PRINT 'Finished printing table' SET @Cmd = 'DROP TABLE ' + @ResultTableWithSchema + ';' EXEC [sp_executesql] @Cmd; EXEC [tSQLt_synapse].[Fail] 'There exists unequal rows!'; diff --git a/sql/tSQLt_synapse/StoredProcedures/Private_PrintTable.sql b/sql/tSQLt_synapse/StoredProcedures/Private_PrintTable.sql index 09ecec0..411af66 100644 --- a/sql/tSQLt_synapse/StoredProcedures/Private_PrintTable.sql +++ b/sql/tSQLt_synapse/StoredProcedures/Private_PrintTable.sql @@ -66,7 +66,7 @@ BEGIN SELECT @ColumnList = STRING_AGG( QUOTENAME([column_name]) - + SPACE(GREATEST([max_len], LEN(QUOTENAME([column_name]))) - LEN(QUOTENAME([column_name]))), + + SPACE(GREATEST([max_len], LEN(QUOTENAME([column_name]))) - LEN(QUOTENAME([column_name])) + 1), ' ' ) WITHIN GROUP (ORDER BY [column_id] ASC) FROM #column_max_len; @@ -81,12 +81,12 @@ BEGIN 'CAST(' + QUOTENAME([column_name]) + ' AS NVARCHAR(MAX)) + SPACE(GREATEST(' + CAST([max_len] AS NVARCHAR(MAX)) - + ',LEN(' + + ',LEN(QUOTENAME(''' + [column_name] - + ')) - LEN(' + + '''))) - LEN(' + [column_name] + '))', - ', ' + ',' ) WITHIN GROUP (ORDER BY [column_id] ASC) FROM #column_max_len; @@ -96,13 +96,12 @@ BEGIN DECLARE @Output NVARCHAR(MAX); SELECT @Output = STRING_AGG(RowText, CHAR(10)) FROM ( - SELECT CONCAT_WS('','', ' + @ColumnCastList + ') AS RowText + SELECT CONCAT_WS('', '', ' + @ColumnCastList + ') AS RowText FROM [' + @SchemaName + '].[' + @TableName + '] ) t; PRINT @Output;'; -- Execute the dynamic SQL EXEC [sp_executesql] @Command; - PRINT @Command END END;