Oca 15 2010

To reset auto increment SQL SERVER

Category: SQLLatif @ 16:52

Hi,

If you want to reset auto increment field, use the code below.

 DBCC CHECKIDENT('TableName', RESEED, 2) ;

See you soon...

 

Tags:

Haz 12 2009

LINQ: Max

Category: ASP.NET | LINQLatif @ 16:47

LINQ da SQL deki max islemini nasil mi yapariz?

Asagidaki sekilde,

MDDBDataContext dc = new MDDBDataContext();

var lastNumber = (from r in dc.RevenueSharings
                                  select (int?)r.StatementNumber).Max();

 

SQL server profiler tarafinda asagidaki sekilde goreceksiniz...

SELECT MAX([t0].[StatementNumber]) AS [value]
FROM [dbo].[RevenueSharing] AS [t0]

Tags: , , ,