Sql Server 高頻高級(jí)語(yǔ)句整理
1,查詢(xún)一個(gè)表的所有字段:
SELECT * FROM syscolumns WHERE id=Object_Id('TableName')
2,清空一個(gè)數(shù)據(jù)庫(kù)里面的所有表數(shù)據(jù):
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