title: How to put insert statement in SQL function?
body: <p>Here is my function which I am trying</p>
  
  <pre><code>CREATE FUNCTION [dbo].[CreateNewRow] 
  ( @pFirstName VARCHAR(50), @pLastName VARCHAR(50) )
  RETURNS INT
  AS
  BEGIN
  
  INSERT INTO [dbo].[Student] ( [FirstName], [LastName] )
  VALUES ( @pFirstName, @pLastName )
  
  RETURN SCOPE_IDENTITY()
  END
  GO
  </code></pre>
  
  <p>Please let me know alternative way if possible.</p>