This type violates the purpose of the relational table, but if you need to, it is not so difficult to do.
1) use ROW_NUMBER() OVER(ORDER BY NameOfColumnToSort ASC) AS Row to create a column for row numbers in your table.
2) Here you can copy (using SELECT columnsYouNeed INTO ) before and after parts of a table into two separate tables (based on the row number you want to insert after it) using WHERE Row < ## and Row >= ## respectively.
3) Then you delete the original table using DROP TABLE .
4) Then you use UNION for the before table, the row you want to insert (using one explicitly defined SELECT without any others) and the after table. Currently, you have two UNION statements for 3 separate select statements. Here you can simply wrap this in a SELECT INTO FROM , calling it the name of your source table.
5) Finally, you DROP TABLE completed two tables.
This is similar to how ALTER TABLE works.
user2074102
source share