求一Sql - MS-SQL Server / 应用实例
我的数据库现存在如下类型字段和数据
A B
712 010101
212 010101
321 010101
434 010101
523 010101
656 010101
怎样将B字段数据实现如下
712 010101
212 010102
321 010103
434 010104
523 010105
656 010106
SQL code:
if not object_id('tb') is null
drop table tb
Go
Create table tb([A] int,[B] varchar(10))
Insert tb
select 712,'010101' union all
select 212,'010101' union all
select 321,'010101' union all
select 434,'010101' union all
select 523,'010101' union all
select 656,'010101'
Go
declare @i int
set @i=0
update tb set b='0101'+right(100+@i,2),@I=@i+1
select * from tb
/*
A B
----------- ----------
712 010101
212 010102
321 010103
434 010104
523 010105
656 010106
(6 個資料列受到影響)
*/
SQL code:
update
tb
set
b=b.b
from
tb a,
(select a,left(b,5)+ltrim(row_number()over(order by getdate())) as b from tb)b
where
a.a=b.a
...
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
相关问答:
执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
sql的软件在哪里可以下啊!在网上找了蛮多都用不了啊
随便搞一D版吧,
迅雷第一个就可以用
2000,2005都这样
http://119.147.41.16/down?cid=0698C2D64D7D637D90A6D2482298E6717D4F15CD&t=2&fmt=-1 ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
运行后报错误如下:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 '数学 + 4where 姓名='王静'' 中。
......