Friday, 18 January 2013

sql server deleted record recover


go to link-
http://raresql.com/tag/recover-deleted-data-from-sql-server/

create stote proc and check all dleetd records
plxz click for above link



Select [RowLog Contents 0]
FROM   sys.fn_dblog(NULL, NULL)
WHERE  AllocUnitName = 'dbo.admin_Login'
       AND Context IN ( 'LCX_MARK_AS_GHOST', 'LCX_HEAP' )
       AND Operation in ( 'LOP_DELETE_ROWS' )

Friday, 4 January 2013

sql server delete or drop all tables


DECLARE @table_schema varchar(100)
       ,@table_name varchar(100)
       ,@constraint_schema varchar(100)
       ,@constraint_name varchar(100)
       ,@cmd nvarchar(200)

DECLARE table_cursor CURSOR FOR

select TABLE_SCHEMA, TABLE_NAME
from INFORMATION_SCHEMA.TABLES
where TABLE_NAME != 'sysdiagrams'

OPEN table_cursor

FETCH NEXT FROM table_cursor INTO @table_schema, @table_name



WHILE @@FETCH_STATUS = 0

BEGIN
SELECT @cmd = 'DELETE' + @table_schema + '.' + @table_name
--SELECT @cmd = 'DROP TABLE ' + @table_schema + '.' + @table_name

EXEC sp_executesql @cmd


FETCH NEXT FROM table_cursor INTO @table_schema, @table_name

END



CLOSE table_cursor

DEALLOCATE table_cursor