select Name as TableName,dbname='数据库',type='User',crdate from sysobjects where xtype='u' and status>=0--可以获取当前数据库中所有表
select name from syscolumns where id=object_id(表)--获取当前表的列
select name AS DB_NAME ,crdate,filename from master..sysdatabases where sid <> 0x01--获取当前所有数据库中所有表
selectfrom syscolumns where id =(select id from sysobjects where xtype='u' and status>=0 and name='表名')--获取当前表中的所有列 select * from information_schema.columns
where table_name ='表名'--获取当前表中的所有列的信息 
restore database 数据库名称 from disk='文件路径' with move '数据库名' to '移动的文件路径' ,move '日志名称' to '移动的日志路径--还原数据库

RESTORE FILELISTONLY From disk='备份数据库的路径’--获取备份数据库的逻辑名称
backup database myplan to disk='备份数据库的路径'with init--完整备份数据库
exec sp_rename '旧表名','新表名'--对表重命名
EXEC   sp_rename   'df.[Country]','title','COLUMN' --对列名重命名  
EXEC sp_helpconstraint hhh--获取当前表的约束
posted on 2007-07-05 21:03  阳春  阅读(729)  评论(2)    收藏  举报