Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SQL Server Insert on the last Row

I have a statement which Inserts a new row to the table in my database, but the new row is added on the first row of the table. I want to add a new row on the end of the table, how would I do this?

INSERT INTO myTable(IFACTUURREGELNUMMER, FACTUURNUMMER, REGELNUMMER, KOSTCODE, DOSSIERNUMMER, OMSCHRIJVING, RELATIE, PRIJS, AANTAL, BEDRAG, VALUTA, BTWCODE, BTWBEDRAG)
    VALUES (@INVOICELINENUMBERM, @INVOICENUMBER, @RULENUMBER, @COSTCODE, @CASENUMBER, @DESCRIPTION,@RELATION, @PRICE, @QUANTITY, @AMOUNT, @CURRENCIES, @BTWCODE, @BTWAMOUNT)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

There is no first or last in a table.

Anyway: You can use ORDER BY

SELECT * FROM myTable ORDER BY IFACTUURREGELNUMMER DESC

You can also have multiple ORDER BY

SELECT * FROM myTable ORDER BY IFACTUURREGELNUMMER DESC, INVOICENUMBER ASC
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading