R
René de Leeuw
Hi,
Can someone provide me with code how to send a string (@name) to the test
table. And how to read the result column wich contains the just generated
testid value from the test table. Here details of the table and the stored
procedure. Thanks in advance.
Regards René.
CREATE TABLE [test] (
[testid] [int] IDENTITY (1, 1) NOT NULL ,
[name] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
CREATE proc ins_test
@name char (10)
AS
SET NOCOUNT ON
BEGIN TRAN
INSERT INTO test
(name)
VALUES (@name)
SELECT @@identity AS result
COMMIT TRAN
SET NOCOUNT OFF
GO
Can someone provide me with code how to send a string (@name) to the test
table. And how to read the result column wich contains the just generated
testid value from the test table. Here details of the table and the stored
procedure. Thanks in advance.
Regards René.
CREATE TABLE [test] (
[testid] [int] IDENTITY (1, 1) NOT NULL ,
[name] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
CREATE proc ins_test
@name char (10)
AS
SET NOCOUNT ON
BEGIN TRAN
INSERT INTO test
(name)
VALUES (@name)
SELECT @@identity AS result
COMMIT TRAN
SET NOCOUNT OFF
GO