我想逐行选择,我想给行号不是任何值 [英] i want to select from table by row i want to give the row number not any value

查看:73
本文介绍了我想逐行选择,我想给行号不是任何值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从tablename中选择theRowNumber = 1 ///第一行>>>等等我只想给

///行没有列的任何值

select from tablename where theRowNumber = 1 ///first row >>>and so on just i want to give
///the row no any value of columns

推荐答案

您可以使用带有Row_Number的公用表表达式来获得适当的结果 - http://blog.troyd.net/Use+A+Common+Table+Expression+Along+使用+ ROWNUMBER + To + Paginate + Records + In + Your + SQL + Server + Queries.aspx [ ^ ]。



还要检查这是否对你有帮助 - SQLA查询中的行号(Microsoft SQL Server 2000和2005) [ ^ ]。
You could use a Common Table Expression with Row_Number to get appropriate results - http://blog.troyd.net/Use+A+Common+Table+Expression+Along+With+ROWNUMBER+To+Paginate+Records+In+Your+SQL+Server+Queries.aspx[^].

Also check if this helps you - Row Numbers in SQLA Query (Microsoft SQL Server 2000 and 2005)[^].


这是一些东西。假设表[tablename]是这样的:

Here''s something. Assuming the table [tablename] was made like this:
--USE [cpqaAnswers]
--GO
--CREATE SCHEMA [cpqa]
CREATE TABLE [cpqa].[tablename](
   [row][nvarchar](76)
    )



这样做:


Do this:

CREATE TABLE [cpqaAnswers].[cpqa].[tablenameIdx](
   [theRowNumber][int]IDENTITY(1,1),
     [row][nvarchar](76)
     )



然后,这样做:


Then, do this:

INSERT INTO [cpqaAnswers].[cpqa].[tablenameIdx]
  SELECT * FROM [cpqaAnswers].[cpqa].[tablename]



现在有一个索引前缀到上一个数据表,并使用提到的分配方式,可以通过它访问每一行数据。


Now there''s an index prefixed to the previous data table and, using the assignment style mentioned, each line of data is accessible through it.


这篇关于我想逐行选择,我想给行号不是任何值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆