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

求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
--truncate table table1 --删除table1

select *
into table1
from table2



这样是不是更快?

还有很多列没些出来的。。。

SQL code



Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/



相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

sql小小的疑问 - .NET技术 / C#

可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......

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

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

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

现在有一个部门表dept(部门名称,部门号。。)有一个人员表emp(姓名,人员编号,职位,薪资,部门)
emp表中的内容是这样的:
a 1 工程师 3000 软件部
b 2 普通员工 2000 硬件部
c 3 工程师 4000 硬件部
d ......

关于SQL语句OR的问题 - Oracle / 高级技术

通过NAME字段条件查询一个数据表,假设我有100个姓名,有以下两个方法,
方法1:
把100个Name 组成一个SQL语句,比如 Select * from tmp_table where Name='张三' or Name ='李四' Or ...Or Name='第一百个姓名'
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号