|
Posted by Hugo Kornelis on 10/26/05 22:19
On 26 Oct 2005 07:55:17 -0700, heromull wrote:
>Thank you so much for the support! I think this will work for us. My
>only other question would be about managing the surrogate column
>(RowNo). During Inserts, is there a way to manage it within SQL Server
>or would my client apps need to select max(RowNo) and increase it by 1?
Hi heromull,
A typical INSERT statement would roughly look like this:
INSERT INTO Answers (CustomerId, TableNo, RowNo, [Value])
SELECT @CustomerId, @TableNo, COALESCE(MAX(RowNo),0) + 1, @Value
FROM Answers
WHERE CustomerId = @CustomerId
AND TableNo = @TableNo
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
[Back to original message]
|