CREATE PROCEDURE [dbo].[procxkbNews_infoInsert]
@newsType int='1',
@newsTitle nvarchar(150),
@storeUrl varchar(100),
@comeFrom varchar(100),
@adder varchar(50),
@clicks int='1',
@titleColor varchar(50),
@isComment bit,
@isRecommend bit,
@picUrl varchar(100)
AS
INSERT INTO News_info(NewsType,NewsTitle,StoreUrl,ComeFrom,Adder,Clicks,NewsTitleColor,IsComment,IsRecommend)
VALUES (@newsType,@newsTitle,@storeUrl,@comeFrom,@adder,@clicks,@titleColor,@isComment,@isRecommend)
declare @a int
set select @@identity;print @aINSERT INTO picNews (NewsId,PicUrl) VALUES(@a,@picUrl)
GO
为什么@a为null值
@newsType int='1',
@newsTitle nvarchar(150),
@storeUrl varchar(100),
@comeFrom varchar(100),
@adder varchar(50),
@clicks int='1',
@titleColor varchar(50),
@isComment bit,
@isRecommend bit,
@picUrl varchar(100)
AS
INSERT INTO News_info(NewsType,NewsTitle,StoreUrl,ComeFrom,Adder,Clicks,NewsTitleColor,IsComment,IsRecommend)
VALUES (@newsType,@newsTitle,@storeUrl,@comeFrom,@adder,@clicks,@titleColor,@isComment,@isRecommend)
declare @a int
set select @@identity;print @aINSERT INTO picNews (NewsId,PicUrl) VALUES(@a,@picUrl)
GO
为什么@a为null值
set @a= @@identity
print @a
declare @a int
set @a=@@identity;
或者
declare @a int
select @a=@@identity;
@newsType int='1',
@newsTitle nvarchar(150),
@storeUrl varchar(100),
@comeFrom varchar(100),
@adder varchar(50),
@clicks int='1',
@titleColor varchar(50),
@isComment bit,
@isRecommend bit,
@picUrl varchar(100)
AS
INSERT INTO News_info(NewsType,NewsTitle,StoreUrl,ComeFrom,Adder,Clicks,NewsTitleColor,IsComment,IsRecommend)
VALUES (@newsType,@newsTitle,@storeUrl,@comeFrom,@adder,@clicks,@titleColor,@isComment,@isRecommend)
declare @a int
set @a=@@identity;
print @a
INSERT INTO picNews (NewsId,PicUrl) VALUES(@a,@picUrl)
GO
@newsType int,
@newsTitle nvarchar(150),
@storeUrl varchar(100),
@comeFrom varchar(100),
@adder varchar(50),
@clicks int,
@titleColor varchar(50),
@isComment bit,
@isRecommend bit,
@picUrl varchar(100)
AS INSERT INTO News_info(NewsType,NewsTitle,StoreUrl,ComeFrom,Adder,Clicks,NewsTitleColor,IsComment,IsRecommend)
VALUES (@newsType,@newsTitle,@storeUrl,@comeFrom,@adder,@clicks,@titleColor,@isComment,@isRecommend)
declare @a int
select @a = @@identity; print @a INSERT INTO picNews (NewsId,PicUrl) VALUES(@a,@picUrl)
GO
DECLARE @a int
SELECT @a= @@identity
PRINT @a
SET @a= @@identity
declare @a int
select @a=@@identity