Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with this ASAP!! There is a new vendor, ‘Think Geek’, that has an invo

ID: 3866495 • Letter: N

Question

Need help with this ASAP!!

There is a new vendor, ‘Think Geek’, that has an invoice for $2,599.98 for slingshot monkeys used as office toys. Please insert the data, filling in information from your imagination. Make sure you have all inserts necessary for a new vendor and a new invoice. 5. The vendor ComputerWorld is incorrectly listed on invoices. ComputerWorld doesn’t have any invoices but it was inserted into the database as having 1 or more invoice. Those invoices listed as ComputerWorld’s invoices should actually be Data Reproductions Corp. Please make that change in the database.

Here is what I haver for 4, but it ownt work:

INSERT INTO vendors
(VendorName,VendorAddress1, VendorAddress2, VendorCity, VendorState, VendorZipcode, VendorPhone, vendorcontactLname, vendorcontactFname)

VALUES ('Think Geek',' PO BOX 98765','7777 Fun Town Street', 'Cincinnati', 'OH', '45246','(888) 555-1234', 'Ziggs', 'Blitz')
INSERT INTO Invoices (VendorID, InvoiceNumber,InvoiceDate, InvoiceTotal,PaymentTotal, CreditTotal, TermsID, InvoiceDueDate, PaymentDate)
Values ('131','45246', '2016-1-04-00:00:00','2599.98', '2599.98', '0.00', '3','2016-1-04-00:00:00', '2016-5-01-00:00:00')

SELECT * FROM Vendors, invoices
WHERE VendorName='ThinkGeek'

Gives me this error:

(1 row(s) affected)
Msg 242, Level 16, State 3, Line 27
The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value.
The statement has been terminated.

(0 row(s) affected)

Thank you

Explanation / Answer

Use CAST to convert time to datetime format...

INSERT INTO vendors
(VendorName,VendorAddress1, VendorAddress2, VendorCity, VendorState, VendorZipcode, VendorPhone, vendorcontactLname, vendorcontactFname)
VALUES ('Think Geek',' PO BOX 98765','7777 Fun Town Street', 'Cincinnati', 'OH', '45246','(888) 555-1234', 'Ziggs', 'Blitz')


INSERT INTO Invoices (VendorID, InvoiceNumber,InvoiceDate, InvoiceTotal,PaymentTotal, CreditTotal, TermsID, InvoiceDueDate, PaymentDate)
Values ('131','45246', CAST('01/04/2016 00:00:01' AS DATETIME),'2599.98', '2599.98', '0.00', '3','2016-1-04-00:00:00', '2016-5-01-00:00:00')


SELECT * FROM Vendors, invoices
WHERE VendorName='ThinkGeek'

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote