求SQL语句 - MS-SQL Server / 基础类
table1
id
01
02
...
table2
id registerdate
01 2010-02-27 22:49:26.633
02 2010-02-27 22:56:23.070
...
在table1中新增regdate 列
并把registerdate列的值插入 regdate列中
SQL code:
--truncate table table1 --删除table1
select *
into table1
from table2
这样是不是更快?
SQL code:
alter table table1 add regdate datetime
update table1 set regdate=registerdate from table2 where table2.id=table1.id
SQL code:
exec ('alter table table1 add regdate datetime')
exec ('update table1 set regdate=registerdate from table2 where table2.id=table1.id')
还有很多列没些出来的。。。
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
<folder state="unchecked&qu ......
需求如下:
学院 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 ......
有这样一条SQL
Select Get_Costtaxrate(col1), Get_Tcostvalue(col1) from a
其中Get_Costtaxrate、Get_Tcostvalue都是函数,这两个函数里面都是查找一个大表,Get_Tcostvalue还需要调用Get_C ......