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

SQL 自增列(非自增字段)

--
> 测试数据:[tb]
if

object_id
(
'
[tb]
'
)
is

not

null

drop

table

[
tb
]
go

create

table

[
tb
]
(
[
id
]

int
,
[
lx
]

int
)
insert

[
tb
]
select

29
,
2

union

all
select

30
,
3

union

all
select

31
,
2

union

all
select

32
,
3

union

all
select

33
,
5
SQL 2000
select

identity
(
int
,
1
,
1
)
as
row_number,id, lx
into
#
temp

from
tb ;
select

*
from
#
temp
SQL2005+
select
row_number()
over
(
order

by
id)
as
row_number,id, lx
from
tb


相关文档:

SQL查表名、字段名、表说明、字段说明

SQL 查看所有表名:
select name from sysobjects where type='U'
查询表的所有字段名:
Select name from syscolumns Where ID=OBJECT_ID('表名')
select * from information_schema.tables
select * from information_schema.views
select * from information_schema.columns
ACCESS
查看所有表名:
se ......

在打包程序中自动安装SQL Server数据库

1、创建安装项目“Setup1”安装项目
在“文件”菜单上指向“添加项目”,然后选择“新建项目”。
在“添加新项目”对话框中,选择“项目类型”窗格中的“安装和部署项目”,然后选择“模板”窗格中的“安装项目”。在&ldquo ......

sql常用

select [name] from sysdatabases order by name--得到数据库中所有的库名
select [name] from sysobjects where xtype='U'and [name]<>'dtproperties' order by [name]--得到数据库表中的列表
select [name] from sysobjects where xtype='V' and [name]<>'syssegments' and [name]<>'sysconstraints' ......

ms sql : xp_cmdshell

向高手请教一个问题:
当我执行:
  use master
exec  xp_cmdshell 'osql /S musqlserver /U sa /P mypwd /d haodb /Q "select top 10 * from trandetail"  /o C:\my1.xls'
以上执行成功,会产生新文件:C:\my1.xls'
然后我想将此文件直接copy到另一台电脑中[已建连接]
执行
   ......

SQL Server 2005 查询分析中删除数据库

USE   master  
GO
DECLARE   @dbname   sysname  
SET  @dbname='TEST' --这个是要删除的数据库库名  
DECLARE @s  NVARCHAR(1000)  
DECLARE tb CURSOR local FOR  
SELECT s='KILL '+CAST(spid AS NVARCHAR)&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号