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

SQL查询每行中最大值的技巧

--------------------------------------------------------------------------
--  Author : htl258(Tony)
--  Date   : 2010-04-23 08:08:36
--  Version:Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
--          Jul  9 2008 14:43:34
--          Copyright (c) 1988-2008 Microsoft Corporation
--          Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3)
--  Blog   : http://blog.csdn.net/htl258
--  Subject: SQL查询每行中最大值的技巧
--------------------------------------------------------------------------
--> 生成测试数据表:tb
 
IF NOT OBJECT_ID('[tb]') IS NULL
    DROP TABLE [tb]
GO
CREATE TABLE [tb](
a SMALLINT,
b SMALLINT,
c SMALLINT,
d SMALLINT,
e SMALLINT,
f SMALLINT,
g SMALLINT
)
INSERT [tb]
SELECT 1,2,3,4,5,2,3 UNION ALL
SELECT 4,5,6,7,7,2,0 UNION ALL
SELECT 4,9,6,7,7,9,6
GO
--SELECT * from [tb]
 
-->SQL查询如下:
 
SELECT *,
    (SELECT MAX(a)
     from(
       SELECT a UNION ALL
       SELECT b UNION ALL
       SELECT c UNION ALL
       SELECT d UNION ALL
       SELECT e UNION ALL
       SELECT f UNION ALL
       SELECT g
       ) AS t  
    ) AS maxvalue
from tb
 
 
/*
a      b      c      d      e      f      g      maxvalue
------ ------ ------ ------ ------ ------ ------ --------


相关文档:

一次插入多条信息(sql)

注释:只适合单表单列数据,
create database test
go
use test
go
create table users
(
:id int identity(1,1) primary key not null,
:name nvarchar(20)
)
go
create proc sp_Inserts
@Names nvarchar(4000)
as
declare @Name nvarchar(20),@ErrorSum int
:set @ErrorSum = 0
:begin tra ......

Merge SQL 2008

merge [target] t
using [source] s on t.id = s.id
when matched then update t.name = s.name, t.age = s.age -- use "rowset1"
when not matched then insert values(id,name,age) -- use "rowset2"
when source not matched then delete; -- use "rowset3"
MERGE dbo.table AS im ......

sql server 日志文件的收缩

完全备份或日志备份虽说都有截断日志的功能,但是不会收缩日志文件的空间返回给操作系统.
如果你想将日志文件的空间返回给操作系统的话,只有一种方法,就是收缩数据库(选择日志文件)
ZT一个相关帖子,供参考!
物理日志文件:
    这个比较好理解,实实在在的东西,数据库目录下面的.ldf文件就是,有些人喜欢改后 ......

深度对比Oracle与SQL Server – 第一部分



作系统的支持

本和发行版

例、数据库和表空间

例名和SID

统数据库和系统表空间
 
本译文采用知识共享署
名-非商业性使用-相同方式共享 3.0 Unported许可协议
发布,转载请保留此信息
译者:马齿苋 | 链接:http://www.dbabeta.com/2010/oracle-sql-server-comparison-i.html
作者:S ......

JAVA连接sql server 2005 数据库心得

首先得下载驱动程序到微软网站下载Microsoft SQL Server 2005 JDBC Driver 1.2
解压Microsoft SQL Server 2005 jdbc driver1.2.exe,把sqljdbc_1.1复制到%ProgramFiles%(如果系统在C盘则为C:\Program Files)。
设置 Classpath
JDBC 驱动程序并未包含在 Java SDK 中。因此,如果要使用该驱动程序,必须将 classpath ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号