Skip to content

Insert Sales Order Script #2

@schwaggs

Description

@schwaggs

The original query was

DECLARE @___ datetime = GETDATE();
DECLARE @___ datetime = DATEADD(dd, 7, GETDATE());
DECLARE @___ int = 1;

INSERT INTO SalesLT.SalesOrderHeader (OrderDate, ___, ___, ShipMethod)
VALUES (@OrderDate, @DueDate, @CustomerID, ___);

PRINT SCOPE_IDENTITY();

You have replaced PRINT SCOPE_IDENTITY(); with
PRINT @orderID;

And you have added several lines that are not necessary.

The correct script is

DECLARE @OrderDate datetime = GETDATE();
DECLARE @DueDate datetime = DATEADD(dd, 7, GETDATE());
DECLARE @CustomerID int = 1;

INSERT INTO SalesLT.SalesOrderHeader (OrderDate, DueDate, CustomerID, ShipMethod)
VALUES (@OrderDate, @DueDate, @CustomerID, 'CARGO TRANSPORT 5');

PRINT SCOPE_IDENTITY();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions