Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 insert data at bottom of table

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-05-26 : 09:46:58
hi
i have this insert

INSERT INTO dbo.BNYWorkingSecTable
( SECTION )

SELECT SECTION
FROM dbo.GLAccounts1
WHERE NOT EXISTS ( SELECT *
FROM dbo.BNYWorkingSecTable
WHERE dbo.BNYWorkingSecTable.SECTION = dbo.GLAccounts1.SECTION)
SET identity_insert dbo.BNYWorkingSecTable OFF


how do i get it to insert the new data at the bottom of the table

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-26 : 20:00:46
Why does the position of the data matter? Is your posted code a one-time operation?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-05-27 : 03:43:11
no not a 1 time thing. can happens more than once.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-27 : 13:49:33
Then I would advise against this. Why do you need this? Never use IDENTITY_INSERT except for manual processes/one-time work. If the id numbers matter, then stop using an identity column.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -