Find In Database Objects

It searches the text of triggers, UDFs, stored procedures and views for a particular substring, 
returning the name and type of those database objects that match. 
DECLARE @Search varchar(255)
SET @Search='[]'

SELECT DISTINCT AS Object_Name,o.type_desc
    FROM sys.sql_modules        m
        INNER JOIN sys.objects  o ON m.object_id=o.object_id
    WHERE m.definition Like '%'+@Search+'%'
    ORDER BY 2,1

Sterling Isolated Storage Database with LINQ for Silverlight and Windows Phone 7


Sterling is a lightweight object-oriented database implementation for Silverlight and Windows Phone 7 that works with your existing class structures. Sterling supports full LINQ to Object queries over keys and indexes for fast retrieval of information from large data sets.
The goal behind Sterling is to keep it:

  • Non-intrusive. You shouldn’t have to change your classes just to persist them.
  • Lightweight. As of this writing, the DLL for Sterling is under 70 Kb. No one needs to bloat their project for something as simple as persisting data.
  • Flexible. While the core is light, Sterling is designed to handle any serialization task and make it ultra-easy to query databases using LINQ-to-Objects.
  • Portable. Sterling is designed to run on both Silverlight 4.0 and the Windows Phone 7.



Sample App:

Absolute Beginners Guide to Entity Framework


The Essentials

The Entity Framework bridges the gap between how developers commonly manipulate conceptual objects (customers, orders, products; posts, tags, members; wall posts, private messages, friend connections) and the way data is actually stored (records in database tables).  The technical term for a tool that provides this abstraction is object relational mapper (ORM).  ORMs help developers be more efficient and focused, since they don’t need to spend brain cycles thinking about how to communicate with the database.  It also means that the code is more portable – switching database software requires changing a setting in the ORM, not a rewrite of the whole codebase to match the new database’s dialect.  As someone who has programmed using the ORM in Django, I can tell you how such a tool makes development less tedious and more enjoyable when you don’t have to consider SELECTS and INSERTS.  In fact, I’ve never before written a line of SQL, yet I was able to build a rich web application thanks to an ORM.

Getting Started

One of the nice features of using the Entity Framework is its out-of-the-box simplicity.  To my pleasant surprise, I didn’t need to download, install, or patch anything to get started with my first EF app.  I booted up VS 2010, opened a new project, designed my entities, wrote my code, and off I went.  You can probably get a very simple app up and running in about 10 minutes.  To prove it, I’ll do exactly that as a step-by-step walkthrough below.  For this example, I’ll make a simple events calendar.

Read more … Absolute Beginners Guide to Entity Framework – ADO.NET team blog – Site Home – MSDN Blogs

Lucene tutorial is a open source text search engine library, ported from Lucene Java project.
Simone Chiaretta has publised a post series to learn more.

You man also interested in my other posts:

Lucene.Net and Azure


Azure Library for Lucene.Net

“Lucene works on top of an abstract store object called Directory. There are several Directory objects, including FSDirectory, for file systems, and RAMDirectory, for in-memory store. Azure Library for Lucene.Net implements a smart blob-storage Directory object called AzureDirectory which enables the use of Lucene.NET on top of Azure Blob Storage. AzureDirectory automatically creates a local cache of blobs and intelligently auto-uploads them on the fly.

Displaying the Sizes of Your SQL Server’s Database’s Tables


Determining the Space Used by a Database or a particular Table
SQL Server has a handy little system stored procedure named sp_spaceused that will return the space used by a database or by a particular table. To determine the size used by the database, simply run:

EXEC sp_spaceused [table]

Returning the Space Used for All Tables

The sp_MSforeachtable stored procedure is one of many undocumented stored procedures tucked away in the depths of SQL Server. A list of these handy stored procedures can be found at SQL Server 2000 Useful Undocumented Stored Procedures. In short, you can use sp_MSforeachtable like so:

EXEC sp_MSforeachtable @command1="command to run"

In the command to run put a ? where you want the table name to be inserted. For example, to run the sp_spaceused stored procedure for each table in the database, we’d use:

EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"

This will execute EXEC sp_spaceused 'TableName' for each user table in the database.

Combining Multiple Result Sets Into a Single Result Set Using Temporary Tables


-- Create the temporary table...
CREATE TABLE #tblResults
   [name]   nvarchar(50),
   [rows]   int,
   [reserved]   varchar(18),
   [reserved_int]   int default(0),
   [data]   varchar(18),
   [data_int]   int default(0),
   [index_size]   varchar(18),
   [index_size_int]   int default(0),
   [unused]   varchar(18),
   [unused_int]   int default(0)

-- Populate the temp table...
EXEC sp_MSforeachtable @command1=
         "INSERT INTO #tblResults
          EXEC sp_spaceused '?'"
-- Strip out the " KB" portion from the fields
UPDATE #tblResults SET
   [reserved_int] = CAST(SUBSTRING([reserved], 1, 
                             CHARINDEX(' ', [reserved])) AS int),
   [data_int] = CAST(SUBSTRING([data], 1, 
                             CHARINDEX(' ', [data])) AS int),
   [index_size_int] = CAST(SUBSTRING([index_size], 1, 
                             CHARINDEX(' ', [index_size])) AS int),
   [unused_int] = CAST(SUBSTRING([unused], 1, 
                             CHARINDEX(' ', [unused])) AS int)
-- Return the results...
SELECT * FROM #tblResults

This stored procedure will return a single result set. The fields that end in _int are the integer representations of those fields that are returned with KB fields.

image – Displaying the Sizes of Your SQL Server’s Database’s Tables