create table [dbo].[order](
[o_id] [bigint] identity(1,1) not for replication not null,
[o_buyerid] [int] not null
)1.ouput引數返回值
例: 向order表插入一條記錄,返回其標識
create procedure [dbo].[nb_order_insert](
@o_buyerid int ,
@o_id bigint output)as
begin
set nocount on;
begin
insert into [order](o_buyerid )
values (@o_buyerid )
set @o_id = @@identity
endend
儲存過程中獲得方法:
declare @o_buyerid int
declare @o_id bigint
exec [nb_order_insert] @o_buyerid ,o_id bigint
2 return過程返回值
create procedure [dbo].[nb_order_insert](
@o_buyerid int ,
@o_id bigint output)as
begin
set nocount on;
if(exists(select * from [shop] where [s_id] = @o_shopid))
begin
insert into [order](o_buyerid )
values (@o_buyerid )
set @o_id = @@identity
return 1 — 插入成功返回1
endelse
return 0 — 插入失敗返回0
end儲存過程中的獲取方法
declare @o_buyerid int
declare @o_id bigint
declare @result bit
exec @result = [nb_order_insert] @o_buyerid ,o_id bigint
3.select 資料集返回值
create procedure [dbo].[nb_order_select](
@o_id int)as
begin
set nocount on;
select o_id,o_buyerid from [order]
where o_id = @o_id
go儲存過程中的獲取方法:
3.1使用臨時表
create table [dbo].[temp](
[o_id] [bigint] identity(1,1) not for replication not null,
[o_buyerid] [int] not null
)insert [temp] exec [nb_order_select] @o_id
– 這時 temp 就是exec執行select 後的結果集
select * from [temp]
drop [temp] — 刪除臨時表
3.2使用openrowset(不過就是速度不怎麼樣)
select * from openrowset(』provider_name','trusted_connection=yes』,'exec nb_order_select』)
儲存過程的三種返回值與其獲得方法
create table dbo order o id bigint identity 1,1 not for replication not null,o buyerid int not null 1.ouput引數返回值 例 向order表插入一條記錄,返回其標識 create procedur...
儲存過程的三種返回值與其獲得方法
create table dbo order o id bigint identity 1,1 not for replication not null,o buyerid int not null 1.ouput引數返回值 例 向order表插入一條記錄,返回其標識 create procedur...
Hive設定引數的三種方法
hive提供三種可以改變環境變數的方法 1.修改 conf hive site.xml配置檔案 在hive中,所有的預設配置都在 conf hive default.xml檔案中,如果需要對預設的配置進行修改,可以建立乙個hive site.xml檔案,放在 conf目錄下。裡面可以對一些配置進行個...