Question: I delete a code block in Jupyter Lab accidentally. Can I find it back?

Answer: 
Just replace with your table and schema:

```
DECLARE @TableSchema SYSNAME
       ,@TableName SYSNAME

SELECT @TableSchema = 'dbo'
      ,@TableName = 'SurveyInstances';

DECLARE @DynamicTSQLStatement NVARCHAR(MAX);

SET @DynamicTSQLStatement = 'DELETE FROM '  + @TableSchema + '.' + @TableName + ' WHERE ' +  STUFF
(
    (
        SELECT ' AND ' + [name] + ' IS NULL' 
        FROM [sys].[columns] 
        WHERE [object_id] = OBJECT_ID(@TableSchema + '.' + @TableName)
            AND [column_id] NOT IN
            (
                SELECT IC.[column_id]
                FROM [sys].[indexes] I
                INNER JOIN [sys].[index_columns] IC
                    ON I.[object_id] = IC.[object_id]
                    AND I.[index_id] = IC.[index_id]
                WHERE I.[is_primary_key] = 1
                    AND I.[object_id] =  OBJECT_ID(@TableSchema + '.' + @TableName)
            )
        FOR XML PATH(''), TYPE
    ).value('.', 'NVARCHAR(MAX)')
    ,1
    ,5
    ,''
);

EXEC sp_executesql @DynamicTSQLStatement;

```

In the above example we are getting the primary key columns (if such exists) in order not to include them in the `WHERE` clause. Then having the columns, just concatenate the `IS NULL` statements and your T-SQL statement is ready.
You can simply run below query for your requirement. It will delete all rows having NULL values(Except ID) COLUMN

```
DECLARE @TSchema SYSNAME
       ,@TName SYSNAME

SELECT @TSchema = 'dbo'
      ,@TName = 'yourTableName';

DECLARE @TSQLStatement NVARCHAR(MAX);

SET @TSQLStatement = 'DELETE FROM '  + @TSchema + '.' + @TName + ' WHERE ' +  STUFF
(
    (
        SELECT ' AND ' + [name] + ' IS NULL' 
        FROM [sys].[columns] 
        WHERE [object_id] = OBJECT_ID(@TSchema + '.' + @TName)
            AND [column_id] NOT IN
            (
                SELECT IC.[column_id] FROM [sys].[indexes] I
                INNER JOIN [sys].[index_columns] IC ON I.[object_id] = IC.[object_id]
             AND I.[index_id] = IC.[index_id]
                WHERE I.[type] = 1
                    AND I.[object_id] =  OBJECT_ID(@TSchema + '.' + @TName)
            )AND name <> 'id'
        FOR XML PATH(''), TYPE
    ).value('.', 'NVARCHAR(MAX)')
    ,1
    ,5
    ,''
);

EXEC sp_executesql @TSQLStatement;

```

Feel free for any query.