Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2005-11-22 : 10:21:12
|
| Could somebody help me on this one please?I have created a sp to insert data, as well as getting the ID back. Only the first part is working.CREATE PROCEDURE [INV_setRollNum] @Item varchar(50),@ItemDesc varchar(50),@PO varchar(50),@Supplier varchar(50),@WorkOrder varchar(50),@NewID int OutputasSet Nocount on INSERT into Sts_RollNum (Item, ItemDesc, PO, Supplier, WorkOrderNum) Values (@Item, @ItemDesc,@PO, @Supplier,@WorkOrder )Select @NewID = @@IdentitySet Nocount offGORunning following tsql in QA, will insert the data, but no ID returned!declare @NewID as intexec INV_setRollNum '00100060','test','PO-67163','myself','234', @NewIDPrint @NewIDThanks! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-11-22 : 10:22:44
|
| exec INV_setRollNum '00100060','test','PO-67163','myself','234', @NewID OUTPUT-----------------[KH] |
 |
|
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2005-11-22 : 11:12:39
|
| Thanks a lot! |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-11-22 : 11:20:50
|
| use SCOPE_IDENTITY(). |
 |
|
|
|
|
|
|
|