DCSIMG
Sql Server 2005 - Wortzel's blog

Wortzel's blog

.Net (2.0, 3.0, 3.5), C#, Asp.net, Com+, GIS(ESRI Software), Management, Analysis & Design, Life, Trips, And more...

Browse by Tags

All Tags » Sql Server 2005 (RSS)
Implementing SqlBulkCopy in Linq to Sql
As I already mentioned in one of my previous post , the SqlBulkCopy is a powerful tool which gives us an option to perform insertion for a large amount of data. The evolution of the ADO.NET creates us the Linq to Sql, as a great O/R Mapping framework from Microsoft kitchen. One of the missing features in Linq to Sql is the ability to use some bulk insert capabilities. In order to improve our Linq to Sql infrastructure I decided to implement the bulk insert as part of the Table class, and I will show...

Posted Tuesday, May 06, 2008 12:30 AM by Avi Wortzel | 10 comment(s)

Testing LINQ to SQL with Mock Object – a complete solution
For the last few weeks I was looking for a complete solution to implement LINQ to SQL in our system. Before I started the searching process I have defined to myself some basic requirements from it: · Rapid development in at least 80% of the cases. · Easy to use , understandable API. · Migration plain or good solution to work with our legacy code . · Easy to maintenance . · Testability framework! One of the major disadvantages of the LINQ to SQL framework is the difficult to test it. If you’ll try...

Posted Tuesday, March 25, 2008 6:18 PM by Avi Wortzel | 1 comment(s)

5 things you should know about SqlBulkCopy
SqlBulkCopy in a new powerful feature in ADO.NET 2.0 which let you to load large amount of data into Sql Server table. It provides you the same functionality as the bcp command-line, with significant performance advantage. Furthermore, all this occurs in standard manage code! In order to use the SqlBulkCopy you must use Sql Server Table as a target table. But in the source, you can use any source which can loaded into DataTable or to implement the IDataReader interface. The SqlBulkCopy class has...

Posted Wednesday, February 27, 2008 8:39 AM by Avi Wortzel | 1 comment(s)

How to debug a stored procedure in your Sql Server 2005
In my company there is a sophisticate logic layer in Sql Server DB. In order to write tests that will check this code we need to write some T - SQL code. The test methods including a serious of initialization script before and after each one of them. I’m going to share you with a very helpful way to debuging this important code by using SQLCLR abilities. The first thing we should do is to open a new Sql Database Project. Create a new SQL Server Project, by adding a new project and selecting SQL Server...

Posted Sunday, September 30, 2007 9:19 PM by Avi Wortzel | with no comments

Working with Sql Server Project
In this post, I want to share with you a great solution to one of the biggest problem in the development life cycle. Almost every system work with a data. We usually store it in db and when we do it we will get all db capabilities (Multiple users, Security, Performance, and much more). But one of the most hurtful thing in development process is the db source control. We always have some troubles in managing database entities. Furthermore, when we want to do some maintenance operation on our database...

Posted Sunday, September 30, 2007 8:57 PM by Avi Wortzel | 2 comment(s)

How to synchronize between local Sql servers (compact edition and mobile) to Sql server 2005
One of the common options to synchronize several distributed sql servers to a central Sql server 2005 is by using Remote Data Access Synchronization (RDA). I needed to check this option for one of my project. What does it give us? How does it work? The RDA tries to give us a solution to access data that stores in a central Sql server form local db's (Sql server mobile and Sql server compact edition databases). It includes a tacking engine that stores all changes in the remote db and pushes it...

Posted Friday, July 27, 2007 5:38 PM by Avi Wortzel | 2 comment(s)

Working with large objects
In SQL server 2005 you have some options to work with large objects. If the data is binary you should use the Binary Large Object (BLOB), and if the data is textual you should use the Character Large Object (CLOB). The BLOB objects and the CLOB objects have a capacity of 2^127 bytes. When you are dealing with a large object you should ask yourself: Isn’t this object to big to load it from the memory? If the object is too big you should consider using a streaming method. When using a streaming method...

Posted Monday, May 21, 2007 11:17 PM by Avi Wortzel | 7 comment(s)

Transactions in .Net v2.0 (Distribute and local)
What is a transaction , in one word? ACID . A tomicity: One block that can't be broken into smaller parts. C onsistency: Works on consistent view and leaves the DB in a constituently state. I solation: Effects only the transaction. D urability: Writes the committed transactions to the database. Single transaction vs. Distributed transactions: Single transaction – a transaction that works on only one durable resource and on a single open connection (also called local lightweight transaction).These...

Posted Friday, May 11, 2007 9:45 AM by Avi Wortzel | 1 comment(s)

How to: Implement an aggregate function in SQLCLR
On my last post I gave a briefing about what is an aggregate function and now I'm going to implement my own aggregate function. How to do it? 1. Open a new SqlServer project. 2. Add a new Aggregate template to your project: 3. Implement four methods: Init : In this method we initialize the fields. Accumulate : This method will be executed on each row. Merge : This method will be executed in a situation that the aggregation process runs in multiple threads and the result need to be combined. Terminate...

Posted Sunday, May 06, 2007 10:23 PM by Avi Wortzel | with no comments

Working with the SQLCLR
In SQL server 2005 you can run .Net code within the DB-Server process (code name SQLCLR or integrated CLR). The SQLCLR family include stored procedure, user defined function, aggregates, triggers and user-define types. For example, you can create a user define aggregate which execute an operation on each row in the query result (this is a function like others system function: sum, average, count, min and max). In my next post I'll show you an example to implement on of these functions.

Posted Friday, May 04, 2007 4:02 PM by Avi Wortzel | 1 comment(s)