MyDevBank

MyDevBank

summaries and tech views for new developers C#,asp.net for web\mobile development,databases,iis6 and more.
Creating this site was an idea that popped up after some programing years, when you have to get back to the same things you all ready forgot, while new stuff is arriving to town. In this site you can find summaries on tech stuff im into, so for a stable wide base knowledge pyramid ,enjoy!!

Stored procedures

T-sql stored procedure

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_Streets_InsertNewStreet]
@street_name nvarchar(15),
@streetXYZ_position nvarchar(50),
@streetXYZ_orientation nvarchar(50),
@details nvarchar(50)
AS
declare @street_code int
set @street_code = (SELECT MAX(street_code) FROM streets)+1
if not exists (SELECT *
    FROM streets
    WHERE (street_name = @street_name))
begin
INSERT INTO streets
    (street_code, street_name, streetXYZ_position, streetXYZ_orientation, details)
VALUES (@street_code,@street_name,@streetXYZ_position,@streetXYZ_orientation,@details)
select 1 as res
end
else
select 0 as res
RETURN


MySQL stored procedure

DELIMITER $$
DROP PROCEDURE IF EXISTS `MyDB`.`sp_InsertNewStuff` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_InsertNewStuff`
(
   in _Name varchar(100),
   in _cItemID integer,
   in _itemID bigint
)
BEGIN
if not exists
(
select MyCol
from thisTBL
where thisName = _Name
and Type_ID = _cItemID
and Item_ID = _itemID
)
then
insert into thisTBL
(
thisName,
Type_ID,
Item_ID
)
values(
_Name,
_cItemID,
_itemID
);
end if;
select max(ID) as ID
from thisTBL
where thisName = _Name
and Type_ID = _cItemID
and Item_ID = _itemID;
END $$
DELIMITER ;

Comment | Related Tags

HOME| IIS6 pipeline| ASP.NET pipeline| Http Modules| Http Handlers| Caching| Web Services| Page Life Cycle| Ajax| Jquery| Session State
ViewState| SEO| Mobile Basics| Mobile Handsets| C# Modifiers| C# Keywords| N-Tier| Design patterns| Stack & Heap| WCF
Databases| Relational Model| functionalities| Stored procedures| fishmarket
MyDevBank
© 2010 All Rights Reserved