Monday, November 16, 2015

How to use stored procedure with Entity Framework Code First

To learn about how we can use stored procedure with Entity framework code first, jalpesh vadgama has written a very good blog post here.

Thanks jalpesh vadgama.

Working with transaction in Entity Framework 6

In  any Relation database, maintaining integrity of database is very important and Transaction is one way of maintaining database integrity. When you have situation, where you need to insert data into multiple tables and if inserting a data in one of the table fails you should always rollback other inserts transaction becomes very useful. Same scenario can be occurred for update or delete operations. If transactions are not there you will be end up with lots of junk data in tables. Entity framework is one of most popular ORM in Microsoft.NET World. So in this post we are going to learn how we can use transactions with Entity Framework 6.

Read full article here by jalpesh vadgama.

How doing a case sensitive search in SQL Server?

Question: How doing a case sensitive search in SQL Server?
Answer:
If Column1 of Table1 has following values ‘CaseSearch, casesearch, CASESEARCH, CaSeSeArCh’, following statement will return you all the four records.
SELECT Column1FROM Table1WHERE Column1 'casesearch'
To make the query case sensitive and retrieve only one record (“casesearch”) from above query, the collation of the query needs to be changed as follows.
SELECT Column1FROM Table1WHERE Column1 COLLATE Latin1_General_CS_AS 'casesearch'
Adding COLLATE Latin1_General_CS_AS makes the search case sensitive.
Default Collation of the SQL Server installation SQL_Latin1_General_CP1_CI_AS is not case sensitive.
To change the collation of the any column for any table permanently run following query.
ALTER TABLE Table1ALTER COLUMN Column1 VARCHAR(20)COLLATE Latin1_General_CS_AS
To know the collation of the column for any table run following Stored Procedure.
EXEC sp_help DatabaseName
Second results set above script will return you collation of database DatabaseName.
Thanks @PinalDave for the beautiful post.

Find a cool free stuff everyday

Giveaway of the Day

Hiren Bharadwa's Posts

DotNetJalps