C# .NET - StoreProcedure

Asked By ricky ponting
03-Feb-12 05:19 AM
 hi

   Plz give a detailed description of stored procedure in mysql.and also give a syntax for insert statement in data layer.
  kalpana aparnathi replied to ricky ponting
03-Feb-12 05:34 AM
hi,

Please check out http://net.tutsplus.com/tutorials/an-introduction-to-stored-procedures/article for introduction for stored procedure For insertion https://developers.google.com/fusiontables/docs/developers_reference

  dipa ahuja replied to ricky ponting
03-Feb-12 05:50 AM
Stored procedures are special objects available in sql server. Its a precompiled statements where all the preliminary parsing operations are performed and the statements are ready for execution.

Its very fast when compared to ordinary sql statements where the sql statements will undergone a sequence of steps to fetch the data

Stored procedure involves various syntax based on the parameters passed. Let me show you a generic syntax for a stored procedure.

Code:
 Create procedure procName
 as
 begin
   ----Your query should be return here
 end
To execute the stored procedure we have to use exec command,
Code:
exec procName
 
  Lalit M. replied to ricky ponting
03-Feb-12 05:53 AM
Hi.

Show  here code sample

DROP PROCEDURE IF EXISTS `sp_students_INSERT_byPK` 
GO

CREATE PROCEDURE sp_students_INSERT_byPK
     (
        IN  p_student_id                    INT(11)       , 
        IN  p_password                      VARCHAR(15)   , 
        IN  p_active_flg                    TINYINT(4)    , 
        IN  p_lastname                      VARCHAR(30)   , 
        IN  p_firstname                     VARCHAR(20)   , 
        IN  p_gender_code                   VARCHAR(1)    ,
        IN  p_is_on_staff                   TINYINT(4)    , 
        IN  p_birth_dttm                    DATETIME        
     )
BEGIN 

    INSERT INTO students
         (
           student_id                    , 
           password                      , 
           active_flg                    , 
           lastname                      , 
           firstname                     , 
           gender_code                   ,
           is_on_staff                   , 
           birth_dttm                    
         )
    VALUES 
         ( 
           p_student_id                    , 
           p_password                      , 
           p_active_flg                    , 
           p_lastname                      , 
           p_firstname                     , 
           p_gender_code                   , 
           p_is_on_staff                   ,
           p_birth_dttm                    
         ) ; 
END 

GO

You will note that just like in a INSERT statement you do not have to use all of the columns available when creating a stored procedure. You must however populate all columnar data associated with the PK (primary key), and columns associated with unique indexes (note: there are exceptions to this, but they will not addressed here), and columns defined in the ddl as "NOT NULL".

  Somesh Yadav replied to ricky ponting
03-Feb-12 06:52 AM
hi you can go through the link u can understandvery well


http://www.datingking.com/
Create New Account
help
Stored Procedure hi, Can we execute a stored procedure inside another stored procedure?Plz help me urgently. . . . . Hi, yes you can execute another Stored Procedure inside a stored procedure. you can use it like this. . create procedure [StoredProcedure1] as exec
can u explain how to create stored procedure. . in sql server = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - - Create basic stored procedure template with TRY CATCH - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - - Author: <Author, , Name> - - Create date: <Create Date, , > - - Description: <Description, , > - - = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = CREATE PROCEDURE <Procedure_Name, sysname, ProcedureName> - - Add the parameters for the stored procedure
stored procedure Hi how to create stored procedure for insert values into tables create procedure spInsertDetails ( @rollNo int, @name varchar(50) ) as declare @NoOfRows int select @NoOfRows = count(*) from table2 if @NoOfRows < = 0 begin insert into table2 values(@name, @rollno) end Hi, try the following stored procedure create procedure InsertUser ( @Name nvarchar(100), @Age int ) As Begin insert into Employee (Name
SqlParameters to be assigned values< / param> / / / <param name = "dataRow"> The dataRow used to hold the stored procedure's parameter values< / param> private static void AssignParameterValues(SqlParameter[] commandParameters, DataRow dataRow) { if ((commandParameters = = null param> / / / <param name = "transaction"> A valid SqlTransaction, or 'null'< / param> / / / <param name = "commandType"> The CommandType (stored procedure, text, etc.)< / param> / / / <param name = "commandText"> The stored procedure name or T-SQL command< / param> / / / <param name = "commandParameters"> An array of SqlParameters to be mustCloseConnection = false; } / / Associate the connection with the command command.Connection = connection; / / Set the command text (stored procedure name or SQL statement) command.CommandText = commandText; / / If we were provided a transaction, assign it
stored procedure What is mean by stored procedure? for all detail with examples Stored Procedure A stored procedure is a set of one or more SQL statements that are stored together in database