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)
 select max with Insert

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-05-27 : 03:49:58
i have this update query

INSERT INTO dbo.BNYWorkingSecTable
( SECTION)
SELECT SECTION
FROM dbo.GLAccounts1
WHERE NOT EXISTS ( SELECT *
FROM dbo.BNYWorkingSecTable
WHERE dbo.BNYWorkingSecTable.SECTION = dbo.GLAccounts1.SECTION)


i want to use a select max and enter that value into the table. how can i get
SELECT MAX(sectionnumber) FROM dbo.BNYWorkingSecTable to work with above update

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-05-27 : 06:19:37
Can anyone help with this
Go to Top of Page
   

- Advertisement -