Sql Server 高频高级语句整理
1,查询一个表的所有字段:
SELECT * FROM syscolumns WHERE id=Object_Id('TableName')
2,清空一个数据库里面的所有表数据:
declare @trun_name varchar(8000)
set @trun_name=''
select @trun_name=@trun_name + 'truncate table [' + [name] + '] ' from sysobjects where xtype='U' and status = 0
select @trun_name