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)
o.name 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 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.
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.
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.
You man also interested in my other posts:
“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.
Determining the Space Used by a Database or a particular Table
SQL Server has a handy little system stored procedure named
sp_spaceusedthat 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
sp_MSforeachtablestored 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
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_spaceusedstored 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 TablesCREATE PROCEDURE dbo.TableSpaceUsed AS -- 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 ([name],[rows],[reserved],[data],[index_size],[unused]) 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
_intare the integer representations of those fields that are returned with KB fields.
An article detailing the odd problems and solutions to using SQL Compact 3.5 in desktop applications
1. Installing the designer
2. Creating the dbml O/R Mapping
3. The connection string
4. Private installation at deployment
Run the query (SELECT * FROM tablename) to get all the data in Query Analyzer, then copy and paste the results from there into Excel. Then save as csv file type.
There are three general ways to invoke mysqldump:
In its simplest form, the mysqldump utility can be used like this:
mysqldump –-user [user name] –-password=[password] [database name] > [dump file]
this will include both the schema and data as well.
If you need only the schema use the -d or --no-data option
e.g. mysqldump -d -u root -pp@ssword mydatabase > mydatabase.sql