Linq to SQL Like Operator
As a response for customer's question, I decided to write about using Like Operator in Linq to SQL queries.
Starting from a simple query from Northwind Database;
var query = from c in ctx.Customers
where c.City == "London"
select c;
The query that will be sent to the database...
This blog related to all the experience that i gain and face during past career. It covers Microsoft technology like. Microsoft Dot Net, SQL Server, Scripting Language etc,.
Pages
Monday, September 30, 2013
Linq to SQL Like Operator Using String.StartsWith or String.Endswith
Read More »
Tuesday, August 20, 2013
How to use transaction in LINQ using C#
LINQ generates DataContext class which provides classes and methods which is used in OR-Mapping. You can also use your stored procedures and views with LINQ. You may require to use transaction with your SPs during Insert, Delete or Update operations.
System.Data.Common.DbTransaction class provides the Transaction object. I have used Northwind database in this...
Friday, August 2, 2013
Using Java Script Bytes Conversion
Function ConvertBytes(ByRef anBytes)
Dim lnSize ' File Size To be returned
Dim lsType ' Type of measurement (Bytes, KB, MB, GB, TB)
Const lnBYTE = 1
Const lnKILO = 1024 ' 2^10
Const lnMEGA = 1048576 ' 2^20
...
Wednesday, July 24, 2013
Partial Classes in C#
Partial classes is a new feature of OOPs in .NET2.0
Partial classes means split the class into multiple files.
When compiled all the files will be treated as a single class.
it may be helpful in large projects,so many people can workon same class.
Advantage:
It is especially useful for: Allowing multiple developers to work on a single class at
the same time without the need for later merging files in
source control.
One of the greatest benefits of partial...
SQL SERVER - Using sp_msforeachtable in sql server
sp_MSforeachtable can be used to loop through all the tables in your databases. Here are some common usages of this useful stored procedureDisplay the size of all tables in a databaseUSE NORTHWIND
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"
Display Number of Rows in all Tables in a databaseUSE YOURDBNAMEEXEC sp_MSforeachtable 'SELECT ''?'', Count(*) as NumberOfRows FROM ?'
Rebuild all indexes of all tables in a databaseUSE YOURDBNAME
GOEXEC sp_MSforeachtable @command1="print...
SQL SERVER - Important Query Part-2
1. COPYING WHOLE DATA OF A TABLE
SELECT * INTO TABLE_DESTINATION FROM TABLE_SOURCE
2. SELECT ONLY DATE PART FROM DATETIME – BEST PRACTICE
Just a week ago my Database Team member asked me what is the best way to only select date part from datetime. When ran following command it also provide the time along with date.
SELECT GETDATE()
ResuleSet : 2007-06-10 7:00:56.107
The required outcome was only 2007/06/10.
I asked him to come up with solution by using date functions. The...
SQL SERVER - Important Query Part-1
1. Finding last time table was updated
SELECT name AS TableName, create_date AS CreatedDate, modify_date as ModifyDate FROM sys.tables order by ModifyDate
2. USING CURSOR IN SQL SERVER
-- exec sp_sc_daily_green_leaf_report_mod '2009-11-04',0,'C1','G1'
/****** Object: Stored Procedure dbo.sp_sc_daily_green_leaf_report_mod Script Date: 11/02/2002 2:15:51 PM ******/
ALTER PROC [dbo].[sp_sc_daily_green_leaf_report_mod]
@TODATE VARCHAR(10) ,
@DIVISION_ID INT=0...
Subscribe to:
Posts (Atom)
My Blog List
-
-
-
-
Kumaon University Nainital B.Ed entrance exam test result 2012 - कुमाऊँ विश्वविधालय, नैनीताल (उत्तराखण्ड)11 years ago