March 12, 2008 at 8:11 am
create table manufacture_master1 (manufacturer_name varchar(25), manufact_id bigint primary key, isactive bit)
/*procedure [dbo].[ADD_manufacture_master1 ]*/
create procedure [dbo].[ADD_manufacture_master1 ]
(
@i_manufacturer_name varchar(25),
@i_manufact_id bigint,
@i_is_active bit
@v_error_no int
)
as
SET NOCOUNT ON
/********************************************************************************************
System : Project Name
Description : Purpose
Modifications History
--------------------------------------------------------------------------------------------
Date By Remarks/Reason
--------------------------------------------------------------------------------------------
Created
Modified -- Reason
declare @v_error_no int
exec ADD_manufacture_master1 'Reynolds','ry121','0',@v_error_no
print @v_error_no
Select 1 from manufacture_master1 where manufacturer_name = 'Cello'
select 1 from manufacture_master1 where manufact_id = 'clo12'
select 1 from manufacture_master1 where is_active = '1'
*********************************************************************************************/
begin
/* Same manufacturer_name Already Exists or Not */
if exists ( select 1 from manufacture_master1 where ltrim(UPPER( manufacturer_name)) = ltrim(UPPER(@i_manufacturer_name)))
begin
set @v_error_no = 3
return
end
begin
/* Same manufact_id Already Exists or Not */
if exists ( select 1 from manufacture_master1 where manufact_id = @i_manufact_id
begin
set @v_error_no = 3
return
end
print @v_error_no
/* Insert into manufacture_master */
insert into manufacture_master1
( manufacturer_name
manufact_id
)
values
(
@i_manufacturer_name
@i_manufact_id
)
if @@error <> 0 or @@rowcount = 0
begin
set @v_error_no = 9999
return
end
set @v_error_no = 9001
end
March 12, 2008 at 1:00 pm
Yes it is.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply