开发者

Save row's position without a positioning column in SQL Server 2005

Here is the table structure:

Id | Description
1  | Test1
2  | Test2

In asp.net forms, I have two fields for inserting values for this table.

As I can't add a new column for memorizing the posi开发者_开发技巧tion of rows, do you have any ideas for accomplishing this functionality?

Edit:

I don't know whether stored procedure can do this or not.


Well you could just append the order value as a suffix in the description, and when you read out the value you would remove the suffix when displaying it.

If your order is "Test2","Test1","Test3":

Id | Description
1  | Test1-2
2  | Test2-1
3  | Test3-3

Of course this is a horrible hack and you should rather add another column in your db table. But if you are unable to do this, this is the only solution I see.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜