SQL

SQL 2000 – search all tables

Posted by on April 4, 2010 at 4:11 pm

CREATE PROC SearchAllTables ( @SearchStr nvarchar(100) ) AS BEGIN — Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved. — Purpose: To search all columns of all tables for a given search string — Written by: Narayana Vyas Kondreddi — Site: http://vyaskn.tripod.com — Tested on: SQL Server 7.0 and SQL Server 2000 — Date modified: [...]

SQL: attached a mdf without the log file.

Posted by on February 19, 2010 at 8:02 pm

Missing ldf file Solution You can attach a database without the logfile by attaching, then clicking the logfile location, and click the remove button. After you click OK a new logfile will be created for your database

sQL: SQL 2000 truncate logs using DBCC

Posted by on January 22, 2010 at 7:10 pm

DBCC statememnts act as Database Console commands. You can use the below listed queries, sprcifically the DBCC ones to shrink your transaction log. – To GET the name of the log and data files select name from dbo.sysfiles – SEE the active transactions as well as the File ID dbcc loginfo(‘db_Name’) – Mark transactions inactive [...]

SQL 2008 : Delete all tables in a db

Posted by on November 27, 2009 at 4:10 pm

Reference EXEC sp_MSforeachtable @command1 = “DELETE FROM ?” EXEC sp_MSforeachtable @command1 = “TRUNCATE TABLE ?” —— You won’t be able to run TRUNCATE against all tables if you have foreign keys references Here is one way to circumvent that – First disable referential integrity EXEC sp_MSForEachTable ‘ALTER TABLE ? NOCHECK CONSTRAINT ALL’ GO EXEC sp_MSForEachTable [...]

SQL: HRESULT 0×80070008

Posted by on August 21, 2009 at 7:59 pm

Error: Failed to open malformed assembly ‘mscorlib’ with HRESULT 0×80070008. If you are sure your SQL query is correct trying having your webhost restart the SQL server engine. This error could mean the SQL process does not have enough memory to process your request.. other error: There is insufficient system memory in resource pool to [...]