Hello I was creating a Stored PROC, so I went into a new Query typed out the following SQL to test before I create the Stored PROC and now when I type
select * From InvoicesT; it just keeps trying without returning anything. I believe that the transaction is still open Please tell me away to close.
BEGIN TRAN INSERT INTO InvoicesT(CompanyID,ContactsID, DueDate, Paid, Estimate, Billed) VALUES( (SELECT c.[CompanyID] FROM CompanyT AS C WHERE c.ComapnyName = 'Jaila Files'), (SELECT co.ID FROM ContactT as co WHERE co.LastName +', ' +co.FirstName = 'Tays, James'), GETDATE()+7, 0, 0, 0 ); go DECLARE @InvoiceNum int @InvoiceNum = SELECT distinct SCOPE_IDENTITY() FROM InvoicesT Insert INTO InvoiceItems ([InvoiceNumber],[Amount],[Description],[EmployeeID],[Hours],[Product]) VALUES ( @InvoiceNum, --Invoice Number 0.01, -- amount 'This is a Test', --Description (SELECT e.EmpolyeeID FROM EmployeesT AS e WHERE e.FirstName = 'James' AND e.LastName = 'Tays'), -- EmployeeID 1, -- Hours (SELECT p.ID FROM ProductsT as p WHERE p.ProductName = 'Excel') ) COMMIT TRAN
There was an error on DECLARE @InvoiceNum