November 10, 2005 at 9:04 am
I have the following snippet of code:
select 'L' as RECTYPE, identity(int, 1, 1)as JELINENO, '800002' as JENO, 'AJE' as JECODE,
'2006' as FY,
I am saving this output into a #Temp table and after using the information I am dropping the table. The questions is, is there a way to increment the JENO by 1 each time the process runs?
Thanks,
Dave
November 14, 2005 at 8:00 am
This was removed by the editor as SPAM
November 14, 2005 at 8:09 am
You could "SELECT MAX(JENO)" & add 1 to it...
**ASCII stupid question, get a stupid ANSI !!!**
November 14, 2005 at 8:21 am
I figured this out. The answers is:
(select max(JENO) + 1 from issuesreturns) as JENO,
November 14, 2005 at 8:34 am
right - except your alias 'JENO' would be after your select max(jeno) + 1...
select (max(JENO) + 1) as JENO from issuesreturns
**ASCII stupid question, get a stupid ANSI !!!**
November 14, 2005 at 6:38 pm
If you define your temp table just make the column in question an Identity column.
CREATE TABLE #temp Col1 int IDENTITY(1,1), col2 <datatype>...
Then just dont include this column in your insert list.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply