获得数据库中表字段的名字.txt
来自「动态sql语句基本语法 1 :普通SQL语句可以用Exec执行 eg」· 文本 代码 · 共 24 行
TXT
24 行
获得数据库中所有数据库的名字:select name From sysdatabases
获得某个数据库中所有表的名字:select name from sysobjects where type='U'
获得某个表中字段的名字:select name from syscolumns where id=object_id('表名')
use master
if exists(SELECT * From sysdatabases where name='test3')
drop database test3
create database test3
go
use test3
go
if exists (select * from sysobjects where type='U' and name='abc')
drop table abc
create table abc (
id int not null identity(20011001,1) primary key clustered,
name varchar(6) not null ,class int null , time1 datetime default getdate())
insert into abc
select 'a',1,1 union all
select 'b',2,2
insert into abc values('a',null,default)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?