Current Headline

Listen to Your Daily Tune's

Saturday, October 02, 2010

Stored Procedure-Update

--update stored procedure

CREATE PROC Sp_updatexpertzone (@id     INT,

                                @name1  VARCHAR(20),

                                @xdate  DATETIME,

                                @salary INT)


  UPDATE xpertzoneblogspot

  SET    name1 = @name1,
         xdate = @xdate,
         salary = @salary
  WHERE  id = @id
  --executing stored Procedure

EXEC Sp_updatexpertzone    2, 'update value', '2010-10-01',9000  --select tables again

  SELECT *  FROM   xpertzoneblogspot

The Guru's Guide to SQL Server Stored Procedures, XML, and HTML

Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL & .NET

Read More ....

Stored Procedure-Delete

--Delete Procedure

--as delete from table will be from a unique key and in our table it is primary key

CREATE PROC Sp_deletexpert (@id INT)


  DELETE FROM xpertzoneblogspot WHERE  id = @id

  --executing delete procedure
 EXEC Sp_deletexpert 6

  --selecting database again
  SELECT *  FROM   xpertzoneblogspot 

Read More ....

Stored Procedure

--Stored Procedure

-- they are secured and pre-complied and are faster 

--Stored Procedure can be used for Insert,Delete and Update Statement's

-- we can use to name our stored procedure as usp_insert means user defined stored procedure or


CREATE PROC Sp_insertzpert (

-- defining parameter's

@id     INT,
@name1  VARCHAR(20),
@xdate  DATETIME,
@salary INT)
  INSERT INTO xpertzoneblogspot  

    VALUES     (@id,

  --Now Executing Stored Procedure

  EXEC Sp_insertzpert 6,'new value','2010-10-01',19000

  --Select the Database

  SELECT *  FROM   xpertzoneblogspot


Read More ....

Related Posts with Thumbnails

Xpert-Zone Blog Overview