易截截图软件、单文件、免安装、纯绿色、仅160KB

sqlserver循环生成数据 - MS-SQL Server / 基础类

现在有一个表table1,只有一个字段,varchar(10)
num
111
112
113
114
现在想要循环table1中的所有数据,原来的111生成111001-111999插入到table2中
SQL code:
Select ltrim([num])+right(1000+number,3)col
from tb a,master..spt_values b
where type='P' and number between 1 and 999


sql中的循环要用游标,先占个sf

SQL code:
if not object_id('tb') is null
drop table tb
Go
Create table tb([num] int)
Insert tb
select 111 union all
select 112 union all
select 113 union all
select 114
Go
Select ltrim([num])+right(1000+number,3)col
from tb a,master..spt_values b
where type='P' and number between 1 and 999
/*
col
------------------
111001
112001
113001
114001
111002
112002
113002
114002
111003
112003
113003
114003
111004
112004
113004
114004
111005
112005
113005
114005
111006
112006
113006
114006
111007
112007
113007
114007
111008
112008
113008
114008
111009
112009
113009
114009
111010
112010
113010
114010
111011
112011
113011
114011
111012
112012
113012
114012
111013
112013
113013
114013
111014
112014
113014
114014
111015
112015
113015
114015
111016
112016
113016
114016
111017
112017
113017
114017
111018
112018
113018
11


相关问答:

求一sql语句 - MS-SQL Server / 疑难问题

现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......

sql - MS-SQL Server / 疑难问题

sql的软件在哪里可以下啊!在网上找了蛮多都用不了啊

随便搞一D版吧,

迅雷第一个就可以用
2000,2005都这样

http://119.147.41.16/down?cid=0698C2D64D7D637D90A6D2482298E6717D4F15CD&t=2&fmt=-1 ......

求一个SQL语句 - MS-SQL Server / 基础类

字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......

sql 问题 - MS-SQL Server / 基础类

需求如下:
学院 academy(aid,aname)
班级 class(cid,cname,aid)
学生 stu(sid,sname,aid,cid)
住宿区 region(rid,rname)
宿舍楼 build(bid,rid,bnote) bnote是‘男’/‘女’
宿舍 dorm(did,rid,bid,bedn ......

C# SQL 的UPDATETEXT 问题 - .NET技术 / C#

A表 有两个字段 
  id 唯一数字域
  InfoTxt text 类型
 我现在要把 id 不是14 的所有 InfoTxt字段 文本后面 都加上 'aaa' 
按下面执行下来 只有表最后一行加上了 'aaa' ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号