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 查看所有表名:
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 ......
1、创建安装项目“Setup1”安装项目
在“文件”菜单上指向“添加项目”,然后选择“新建项目”。
在“添加新项目”对话框中,选择“项目类型”窗格中的“安装和部署项目”,然后选择“模板”窗格中的“安装项目”。在&ldquo ......
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' ......
向高手请教一个问题:
当我执行:
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到另一台电脑中[已建连接]
执行
......
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 ......