Dibyajyoti Palata

Dibyajyoti Palata

  • 1.5k
  • 275
  • 14.3k

User defined table in Sql Server

Aug 6 2020 8:38 AM
Can I return integer value after an insert using Stored Procedure with used in user defined type in SQL Server?
 
if successful return 1
if error return 0
if Yes ..
 
How?
 
Please explain with one example.
 
I have created this user type and stored procedure and used in asp.net, it is inserted.
 
But my question is can I return integer value after successful.
  1. CREATE TYPE InsertEmployee AS TABLE(  
  2. [emp_id] [intNOT NULL,  
  3. [emp_name][varchar(100)]  
  4. )  
  5. GO  
  6. CREATE PROCEDURE sp_InsertEmployee  
  7. (  
  8. @DataTableDetails InsertEmployee READONLY  
  9. )  
  10. AS  
  11. BEGIN  
  12. INSERT INTO tbl_employee  
  13. SELECT emp_id, emp_name  
  14. FROM @DataTableDetails  
  15. END  

Answers (3)