34,588
社区成员
发帖
与我相关
我的任务
分享
set @InsertStatement='insert into udsdt_TrainCarriageType (tctf_Index,tctf_Name,tctf_StandardLoadIndex) values ('+ rtrim(@Index)+','''+ @Name + ''', '+ rtrim(@StandardLoadIndex)+')'
create procedure udsp_InsertTrainCarriageType
@Name nvarchar(16),
@StandardLoadAmount real
as
declare @Index smallint
declare @RecordAmount smallint
set @RecordAmount=(select count(*) from udsdt_TrainCarriageType)
if (@RecordAmount=0)
begin
set @Index=1
end
else
begin
set @Index=(select max(tctf_Index) from udsdt_TrainCarriageType)+1
end
declare @StandardLoadIndex smallint
set @StandardLoadIndex=(select tcslf_Index from udfdt_TrainCarriageStandardLoad where tcslf_StandardLoadAmount=@StandardLoadAmount)
declare @InsertStatement nvarchar(512)
set @InsertStatement='insert into udsdt_TrainCarriageType (tctf_Index,tctf_Name,tctf_StandardLoadIndex) values ('+convert(nvarchar(10),@Index)+','''+@Name+''','+convert(varchar(10),@StandardLoadIndex)+')'
execute(@InsertStatement)
go
--try:
create procedure udsp_InsertTrainCarriageType
@Name nvarchar(16),
@StandardLoadAmount real
as
declare @Index smallint
declare @RecordAmount smallint
set @RecordAmount=(select count(*) from udsdt_TrainCarriageType)
if (@RecordAmount=0)
begin
set @Index=1
end
else
begin
set @Index=(select max(tctf_Index) from udsdt_TrainCarriageType)+1
end
declare @StandardLoadIndex smallint
set @StandardLoadIndex=(select tcslf_Index from udfdt_TrainCarriageStandardLoad where tcslf_StandardLoadAmount=@StandardLoadAmount)
declare @InsertStatement nvarchar(512)
set @InsertStatement='insert into udsdt_TrainCarriageType (tctf_Index,tctf_Name,tctf_StandardLoadIndex) values ('+convert(nvarchar(10),@Index)+','''+@Name+''','+convert(nvarchar(10),@StandardLoadIndex)+')'
execute(@InsertStatement)
go
if object_id('Test') is not null drop table test
go
create table Test(A bit,B real,C money)
go
if object_id('P_test') is not null drop Proc P_test
go
create proc P_test
@A bit,
@B real,
@C money
as
insert Test select @A,@B,@C
go
Exec P_test 1,100.98,54.5
select * from test
(1 row(s) affected)
A B C
---- ------------------------ ---------------------
1 100.98 54.5000
(1 row(s) affected)
create proc pr_test
@a bit,
@b real,
@c money
as
return
go
execute pr_test 1,100.98,54.5