Friday, 18 September 2015

How to call a user define function(udf) from Store Procedure:-



Hello Friends,
                      In this Chapter  we will discussed  how  a function will be call  from  Store Procedure in Sql server.First we should know what types of function is availablein sqlserver.
Mainly there are two types of functions in sqlserver database 

1>System define function
2>User Define Function(UDF)

System define function:
           Basically System Define Functions are the built-in function which is provided by microsoft like aggregate function,Configuration function,cursor function,mathematical function,date and time functions  etc…
User Define Function(UDF):
      UDF is created by user mainly it categorized  into three types:
1>scalar function
      Scalar function is that types of function which return a single value through RETURN clause.
2>Inline table-valued function:
          But in Inline table-valued function  has no function body.It contains result set of single select statement and table valued function return a table
3>multistatement table-valued function:
               In  this function  function body defined in a Begin - End Block,which is contains transact-sql statements.
Next Chapter we will briefly discuse  with valuable example,But now I will create a simple scalar function  and call it from store procedure.please follow this step…….

Thursday, 17 September 2015

What is the Difference between Storeprocedure and User Define Function(UDF) in Sqlserver :



 Hello Friends,                                                                                                                          
                  Previous Chapter I have described oop concept in C#.net but now I will expain anther concept in sqlserver i.e What is the difference  between Storeprocedure and Function.
Basically Storeprocedure  is a concept  through which to get /execute the quory on any database server and it can be invoked from any language code and 
                   Function is nothing but  it is a database object which handle different types of functionality.Next chapter I'll briefly describe about Storeprocedure and Function.
Difference between Storeprocedure and User Define Function(UDF):
Store Procedure
User Define Function(UDF)
1
Store procedure is a pre-compiled object ,which are compiled 1st time and it’s code is saved in that area  in which it executes.when it is called it become execute.
1
Function is compiled and executed every time ,when it is called.
2
Procedure can have both  input and out put parameters.
2
But Function  have only input parameter.
3
It is not possible to call procedure from Function.
3
But Function can call from Procedure.
4
Procedure can use select as well as DML(insert,update,delete) Commands or Statements.
4
Function can only use Select statement.
5
Procedure can use Try-Catch block to handle Exception.
5
Function can’t use Try-catch block.
6
Store Procedure may or may not return  any value.
6
Function must return  any value.


I have explained difference between Stored Procedure and Functions (UDF).So after read please Comments and suggestions.
Thanks & Regard
Rabi

Monday, 13 April 2015

Sealed Class in C# Programming

Hello Friends,
                  Previous Chapter I have described oop concept but now I will expain anther concept i,e.Sealed class in C# dot.Generally it is opposite of abstract class  and  it can't  inherited  because when we will create a class as sealed modifier then it will prevant to inherit from this class.

Suppose class c1 and class c2 are two class if we declare sealed to any class that canot be inherit ,just see that small example in below.

Class c1
{
}
sealed class c2:c1
{

}
Note:Now just see that class c2 inherit from class c1,but at 2nd step we have declaed class c2 as sealed so for that reason there is not possible thatno class can inherit from class c2 if we will do than that fire error.

Ex:

using System;

namespace sealedclass
{
sealed class mysealedclass
{

Pure Abstract class in C# dot net

Hello Friends,
Now I am going to describe anther concept i.e.Pure abstract class.It is a extended version of abstract class.which contains only abstract methods but we can't declare a body inside this abstract method.
But the disadvantages of pure abstract class is that this class can't inhert multiple time means that multiple pure abstract class is not possible.So To overcome this problems interface concept is introduced.

Ex:

using System;

namespace pureabstractclass
{
abstract class pureabstract
{
public abstract void mypureabs ();
public abstract void mypureabs1 (int s,int p);
}

Encapsulation in C# dotnet



Hello Friends,                                                                                                                          
                 Now I am going to describe anther oop concept in C#.net i.e. Encapsulation.It  is a  Mechanism which is responsible to hide all internal part of an object  from outer world  and  It’s scope of access and visibility depends upon the access specifier.By using this technique  Data member and member function bind a single unit which leads to data security.
 RealWorldExample                                                                                                                                                                                         When we use computer keyboard for input data at that time we can’t know the internal process means  how it execute internally.
Ex:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace encapsulationprog
{
    class encaps
    {
        private int myencaps1;

Sunday, 12 April 2015

Abstract Class Concept in C#.net

Hello Friends,
            Now I am going to describe anather OOP concept of C# dotnet.Generally Abstraction is a concept through which we can see only assential part of the object ,we can't see the background details or inner part of the object.
                               If we will see the real world example than this concept will be cleared.when we are watching TV then through our Remote we controls any operations means we can move one chanel to anather chanel to enjoy different programs that can be news,songs and serial etc.
             But matter is that when we are enjoying any program in TV at that time we don't try to see any background part of TV like picture tube,circute,electronics chips etc and we donot know about it's internal process or how it work.
        Finally we can say that it is a concept through which the essential part of the object will represented hiding the background detail.It leads to data hiding and data hiding leads to data security.

Ex:
Abstract Class:
       Abstract class is a type of class whose data member and member function can be accessed in derived class.The members of abstract class can be private as well as protected.It is define by abstract key word.
Ex:
using System;

namespace abstractclass
{
abstract class abstractprog
{

Saturday, 11 April 2015

Interface Concept of C# dotnet

Hello Friends,
                                Now I am going to describe the Concept of Interface in C# dot net.Interface is a identical with pure abstract class but advantages of Interface is that multiple interfaces can be implimented.
                 Using this concept We can also invoke the functions from different classes through the same Interface reference.
               It declared by Iterface keyword and deafult behavier of Interface is Public.

Ex:

using System;

namespace Interfaceprog
{
interface myinterfaceA
{
void myfirstinter();
void mysecondinter (string s);
}