English 中文(简体)
在LAST在一系列范围内浏览后,在KQ服务器数据库中安装一个浏览器
原标题:Increment a row in SQL Server database after the LAST row within a range

I have tried looking for an answer for my question but due to lack of proper knowledge in databases, I thought some genius here could help me out.

I m trying to add rows into a database table starting from the number 800 and onwards in a sequential order. The database currently has records from 1 up until 300.

表中的这一记录并非自动增加,而是人工分配。

I basically want to start another batch of numbers, but rather than incrementing them from where the program left off (i.e. from 300) I would like to start them from 800.

我尝试了不同的发言,但没有具体结果。 Im利用PHP进入这些网。

我感到,这 t太硬,但我 m一 , kill!

我认为也许会增加一个记录,从800起开始,然后执行类似声明。

SELECT LAST FROM A RANGE BETWEEN 800 AND 899

这将是前进的道路。

任何帮助、咨询?

问题回答

You can obtain the highest numbered record with the MAX aggregate function. The following will find the next highest number that is between 800 and 899.

SELECT MAX(my_assigned_number) + 1 as next_number
FROM my_table
WHERE my_assigned_number > 800 AND my_assigned_number < 899;




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签