|
Posted by Hugo Kornelis on 08/21/05 14:49
On Sun, 21 Aug 2005 11:02:42 +0200, Andre wrote:
(snip)
>Access;
>INSERT INTO table
>SELECT
> (IIF(code<>Null,MAX(code)+1,1) AS code,
>0 AS usercode
>FROM table
Hi Andre,
As John says: Consider using IDENTITY (the SQL Server equivalent of what
Access calls "autonumber").
If there are reason's why you can't use IDENTITY, then use
SELECT COALESCE(MAX(code), 0) + 1 AS code
FROM table
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
[Back to original message]
|