建一张表 /******************************************************************************** 小区主档记录,要保证与OrgLevelUnit同步 ********************************************************************************/ IF not exists(SELECT OBJECT_NAME (id )FROM sysobjects W…
使用指定数据库 use v4base 建一张表 /******************************************************************************** 小区主档记录,要保证与OrgLevelUnit同步 ********************************************************************************/ IF not exists(SELECT OBJECT_NAME (id…
SQL2000系统表的应用 –1:获取当前数据库中的所有用户表 select Name from sysobjects where xtype=’u’ and status>=0 –2:获取某一个表的所有字段 select name from syscolumns where id=object_id(‘表名’) –3:查看与某一个表相关的视图.存储过程.函数 select a.* from sysobjects a, syscomments b where a.id = b.id and…
IF EXISTS(SELECT * FROM sys.Tables WHERE name='stu_info') DROP TABLE stu_infoGoCreate table stu_info(stu_id int identity(1,1),name nvarchar(20)not null,birthday date null, sex nvarchar(2)null,addres nvarchar(20)null, mark …
sql删除所有表语句: use 数据库名(是要删除表的所在的那个数据库的名称) GO declare @sql varchar(8000) while (select count(*) from sysobjects where type='U')>0 begin SELECT @sql='drop table ' + name FROM sysobjects WHERE (type = 'U') ORDER BY 'drop table ' + name exec(@sql) end-----…