Sir/Madam
How to execute select and insert commands at same time in stored procedure.want to get selected value in data table.
With Regards,
Gomathi.P
Need help in stored procedures
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Manikavelu VelayuthamRank #413 · 6K reputationPosted Sep 19, 2010, 11:35 PM EDT
(@Input1 DataType
@Input2 DataType)
AS
Begin
SELECT * FROM Table1 WHERE columnName = @Input1
Insert INTO Table1 VALUES(@Input1, @Input2)
SELECT * FROM Table1 WHERE columnName = @Input2
End
Above stored procedure will execute the select statement first, insert statement second, and finally the select statement which will be returned as a datatable.
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Sep 19, 2010, 11:43 PM EDT
With Regards,
Gomathi.P
Manikavelu VelayuthamRank #413 · 6K reputationPosted Sep 19, 2010, 11:45 PM EDT