if exists(select name from sysobjects
where name='cangku_in_' and type='p')
drop procedure cangku_in
go
CREATE PROCEDURE cangku_in
@BM char(40),@MCh char(40),@Shzm char(40),@CLFL char(40),
@RiQi smalldatetime,@ShiJian datetime,@GuiGe char(40),@DanWei char(4),
@DanJia float,@ShuLiang float,@CheDui char(40),@LuDui char(20),
@CangKu char(10),@WeiZhiHao char(10),@GongHuoShang char(40),
@ChanDi char(40),@PinPai char(40),@ChangJia char(40),@FPH char(40),
@name char(40)
AS
declare @sql nvarchar(4000)
set @sql="insert into "+@name+" (BM,MCh,Shzm,CLFL,RiQi,ShiJian,GuiGe,DanWei,DanJia,
ShuLiang,CheDui,LuDui,CangKu,WeiZhiHao,GongHuoShang,ChanDi,PinPai,ChangJia,FPH)
values(@BM,@MCh,@Shzm,@CLFL,@RiQi,@ShiJian,@GuiGe,@DanWei,@DanJia,
@ShuLiang,@CheDui,@LuDui,@CangKu,@WeiZhiHao,@GongHuoShang,@ChanDi,@PinPai,@ChangJia,@FPH)"
execute(@sql)
GO
是一个存储过程,其中name是个表名