SQLSERVER的对表的一些操作语句
--插入数据
insert into student(id,sname,j2se,j2ee,jsp)values(1,'张三',80,60,70);
--更新数据
update student set sname= '张三' where id=1;
--增加字段
ALTER TABLE table_NAME ADD column_NAME varchar(30)
--删除字段
ALTER TABLE table_NAME DROP COLUMN column_NAME
--修改字段类型
ALTER TABLE table_NAME ALTER COLUMN column_NAME new_data_type
--查询表的基本信息
EXEC sp_help 'table_NAME '
--查重复数据
select * from [T_USER_LOGIN_INFO] where
(select count(*) from [T_USER_LOGIN_INFO] a where a.name=[T_USER_LOGIN_INFO].name) >1
order by NAME
--SQL 查询所有表名:
SELECT NAME FROM SYSOBJECTS WHERE TYPE='U'
SELECT * FROM INFORMATION_SCHEMA.TABLES
--查询表的所有字段名:
SELECT NAME FROM SYSCOLUMNS WHERE ID=OBJECT_ID(' 表名' )
SELECT * FROM INFORMATION_SCHEMA.VIEWS
SELECT * FROM INFORMATION_SCHEMA.COLUMNS