20080304
20080304

if not exists(select * from information_schema.columns where TABLE_NAME='ms_member' and COLUMN_NAME='remark')
BEGIN
ALTER TABLE ms_member
ADD remark varchar(300)
END
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SAVE_MS_MEMBER]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[SAVE_MS_MEMBER]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE SAVE_MS_MEMBER
	@cd_member 	    	varchar(10),
	@nm_member 	    	varchar(14),
	@ds_member         	varchar(3),
	@ds_sex		varchar(1),
	@no_jumin 	    	varchar(14),
	@ymd_isu        		varchar(8),
	@ymd_birth 	    	varchar(8),
	@ymd_marri      		varchar(8),
	@tel_home       		varchar(13),
	@tel_mobil      		varchar(13),
	@tel_job	    	varchar(13),
	@no_post        		varchar(7),
	@addr1          		varchar(40),
	@addr2          		varchar(40),
	@nm_email       		varchar(40),
	@yn_trust       		varchar(1),
	@cd_sawon_chg 	varchar(8),
	@ds_age		varchar(3),
	@yn_lunar		varchar(1),
	@cd_join		varchar(4),
	@yn_news		varchar(1),
	@ds_status		varchar(1),
	@remark		varchar(300),
	@img_member		image,
	@i_sw     	 	char(1)
AS
begin
	if @i_sw = 0
             begin
	insert into  MS_MEMBER ( 
				cd_member,
				nm_member,
				ds_member,	
				ds_sex,
				ymd_isu,
				no_jumin,
				tel_job,
              			ymd_birth,
				ymd_marri,
				tel_home,		
				tel_mobil,
              			no_post,
				addr1,
				addr2,
				nm_email,
				yn_trust,
				ds_age,
				cd_sawon_chg,
				yn_lunar,
				cd_join,
				yn_news,
				remark,
				ds_status,
				img_member)
                        		values(  
				@cd_member,
				@nm_member,
				@ds_member,
				@ds_sex,
				@ymd_isu,
				@no_jumin,
				@tel_job,
              			@ymd_birth,
				@ymd_marri,
				@tel_home,
				@tel_mobil,
              			@no_post,
				@addr1,
				@addr2,
				@nm_email,
				@yn_trust,
				@ds_age,
				@cd_sawon_chg,
				@yn_lunar,
				@cd_join,
				@yn_news,
				@remark,
				@ds_status,
				@img_member)
            end
            else
            begin
	          update  MS_MEMBER set nm_member=@nm_member,
					ds_member=@ds_member,
					ds_sex	=@ds_sex,
					ymd_isu=@ymd_isu,
					no_jumin=@no_jumin,
					tel_job=@tel_job,
					ymd_birth=@ymd_birth,
					ymd_marri=@ymd_marri,
					tel_home=@tel_home,
					tel_mobil=@tel_mobil,
					no_post=@no_post,
					addr1=@addr1,
					addr2=@addr2,
                    				nm_email=@nm_email,
					yn_trust=@yn_trust,
					ds_age=@ds_age,
                    				cd_sawon_chg=@cd_sawon_chg,
					yn_lunar	=@yn_lunar,
					yn_news	=@yn_news,
					remark		=@remark,
					ds_status	=@ds_status,
					img_member	=@img_member,
					dt_change	=getdate()
                                      where cd_member = @cd_member
           end
end
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO



