Michael,

> What I want to do is have a function that does the increment 
> rather than have SQL do it so user 1's pictures from 1-10 are listed as 1-10 
> and user 2's pictures can also be listed as 1-10


Based on this information, you may want to add another column to your image 
table for use in an 'order by' clause:

ordinal int not null 

Then you could write a function to increment the ordinal value, rather than the 
primary key.  If you ever change your mind about the order in which you want 
the images to display, you could always edit this column.

create function getOrdinal(@id int) 
    returns int
    as
    begin
    return select count(*) + 1 from tbl_image where user_id = @id
    end

I'm not at all sure about the syntax for the function code...

Dina







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Sams Teach Yourself Regular Expressions in 10 Minutes  by Ben Forta 
http://www.houseoffusion.com/banners/view.cfm?bannerid=40

Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2326
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to