Serial Number using ROW_NUMBER (Transact-SQL)

Serial No is possible for your table using ROW_NUMBER


ROW_NUMBER

Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.

Check out this Example


create table myTable
(
intNo int,
fname varchar(200),
mark numeric(5,2)
)


insert into mytable values(1,'xyz',89.45)
insert into mytable values(2,'xyz1',93.45)
insert into mytable values(3,'xyz2',35.45)
insert into mytable values(4,'xyz3',88.45)
insert into mytable values(5,'xyz4',73.45)



select ROW_NUMBER()OVER(ORDER BY mark DESC) AS 'Row Number' ,intNo,
fname,mark from MyTable

output



Note:it will run in sql server 2005 and above...

Difference between MSDE and SQL Server Express 2005


SQL SERVER Express edition is a cut down version of SQL SERVER 2005 and the next evolution of MSDE(MSDE is a cut down version of SQL Server 2000).


  • MSDE maximum database size is 2GB but in SQL SERVER Express has around 4GB.

  • In terms of programming language support MSDE has only TSQL, but SQLSERVER Express has TSQL and .NET.

  • SQL SERVER Express does not have connection limitation, which MSDE had and was controlled through the Workload governer.

  • There was no XCOPY support for MSDE, SQL SERVER Express has it.

  • DTS is not present in SQL SERVER express while MSDE has it.

  • SQL SERVER Express has reporting services while MSDE does not.

  • SQL SERVER Express has native XML support and MSDE does not.

Database restore from SQL Server 7 ,SQL Server 2000 to SQL Server 2005

it is possible to restore database from sql server 7, sql server 2000 to sql server 2005.
it can be achieved by using restore and with replace command

use master

restore database mydatabase from disk ='c:\mybackup.bak' with replace

Sql Server – Backup and Restore Database using SQL Script (T-SQL)

it is easy to take backup in sql server using script without any External tools.
By SIMPLE ways.. as follows...

use master

create database mydatabase

backup database mydatabase to disk ='c:\mybackup.bak'

Yeah,i can be easily restore by simple steps...

use master

restore database mydatabase from disk ='c:\mybackup.bak'

thats all..

Parameter types in C# (Value,out,ref and params)


Value parameters:

Value parameter is also called In parameter. A parameter declared with no modifiers is a
value parameter. Methods are permitted to assign new values to a value parameter. Such assignments only affect the local storage location and it has no effect on the actual argument given in the method invocation.

static void ParamMethod(int Param1)
{
Param1 = 100;
}
static void Main()
{
int Paravalue = 10;
ParamMethod(Paravalue);
Console.WriteLine(Paravalue);
}

//Here the output is 10

Reference Parameter:

Reference parameter declared with a ref modifier. It does not make a new storage location. Instead, a reference parameter represents the same storage location as the variable given as the argument in the method invocation. It should assigned to some value before it go for the method invocation.

static void ParamMethod(ref int Param1)
{
Param1 = 100;
}
static void Main()
{
int Paravalue = 10; //Here Paravalue should assign
ParamMethod(ref Paravalue);
Console.WriteLine(Paravalue);
}

//Here the output is 100

Output parameters:

Output parameter declared with an out. Similar to a reference parameter, an output parameter does not create a new storage location. Instead, an output parameter represents the same storage location as the variable given as the argument in the method invocation.Every output parameter of a method must be definitely assigned before the method returns.

static void ParamMethod(out int Param1)
{
Param1 = 100; //Here Param1 should assign
}
static void Main()
{
int Paravalue ;
ParamMethod(out Paravalue);
Console.WriteLine(Paravalue);
}

//Here the output is 100

Params:

The value passed for a "params" parameter can be either comma separated value list or a single dimensional array. "params" parameters are input only.

static int Summation(params int[] Param1)
{
int Sum =0;
foreach(int P in Param1)
{
Sum = Sum +P;
}
return Sum ;
}

static void Main()
{
Console.WriteLine(Summation(1,2,3));
}

//Here the output is 6