'CREATE FUNCTION' must be the only statement in the batch
<p>I am following the book Microsoft SQL Server 2012 by Patrick LeBlanc. When I use the example in the book for creating inline table-valued functions, i get the error in the title of this post. I tried creating the code by right clicking the 'Functions' -> new -> inline table-valued function and then change the code. I also wrote the entire code from the book. As I can see I have the GO statement before the CREATE FUNCTION statement.
The code looks like this, any idea what is causing this?</p>

<pre><code>USE AdventureWorks2016CTP3;
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION dbo.GetOrderDetails
(
    @SalesOrderID int
)
RETURNS TABLE 
AS
RETURN 
(
    SELECT
        sod.SalesOrderID,
        sod.SalesOrderDetailID,
        sod.CarrierTrackingNumber
        p.Name AS ProductName,
        so.Description
    FROM Sales.SalesOrderDetail AS sod
    INNER JOIN Porduction.Product AS p
        ON sod.ProductID = p.ProductID
    INNER JOIN Sales.SpecialOffer AS so
        ON sod.SpecialOfferID = so.SpecialOfferID
    WHERE
        sod.SalesOrderID = @SalesOrderID
)
GO
</code></pre>