回複:回複:Thanks. But in VB6...

本帖於 2004-02-06 15:24:48 時間, 由普通用戶 old-cotton 編輯
回答: 回複:如果要求第8行的結果dbdb2004-01-12 12:41:00

1
The line of {IDENTITY(int, 1,1) AS row_Num} is called
pseudo-column, it means that column does not existing in schema but needed to support application function.
2
When you use SQL Server's IDENTITY() function, it requests to supply those 3 paramenters, please see SQL server Book-online for details.
3-1
In the real cases when use it, I would write a store procedure with such script, then use pass-through query to call the procedure. This way has very good performance, especially on a larger table, even you can add index on it if you need to do so.
3-2
If you want to use it in VB, I suggest use a sead number
for example 1, then write it in a loop (1++) to gain similar integer array. Under this situation, you should be able to control your random specified row number(s).
But this way runs slower.
3-3
Write a SQL function with to generate a sequential number when you query a table.
3-4
I do not have time to provide another sample code for your because I am on project rollout time. Also, I do not have your problem in my data warehouse system, I solve such potential problem when data modeling.





--文學城www.wenxuecity.com--
請您先登陸,再發跟帖!