sql script: select database select all table
2012-12-27 19:18
246 查看
---表中的主鍵 select [name],'tablekey'= (select top 1 COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where TABLE_NAME = sysobjects.name) from sysobjects where type='U' --所有表 select * from sysobjects where type='U' --所有表的主鍵 COLUMN_NAME select * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE --数据类型 select * from systypes --所有列 select * FROM syscolumns --所有表的數據類型,長度 SELECT d.name TableName,a.name FieldName,b.name TypeName,a.length Length,a.isnullable IS_NULL --INTO #t FROM syscolumns a, systypes b,sysobjects d WHERE a.xtype=b.xusertype and a.id=d.id and d.xtype='U' ---所有表的主鍵 SELECT d.name as 'TableName',a.name as 'FieldName',b.name as 'TypeName',a.length as 'Length',a.isnullable as 'IS_NULL' --INTO #t FROM syscolumns a, systypes b,sysobjects d ,INFORMATION_SCHEMA.KEY_COLUMN_USAGE c WHERE a.xtype=b.xusertype and a.id=d.id and d.xtype='U' and c.TABLE_NAME = d.name and c.COLUMN_NAME=a.name
相关文章推荐
- sql script: select database select all table
- sql script: select database select all table .
- SQL to Select a random row from a database table
- Create country table and insert all the countries script for SQL Server
- SQL to select a random row from a database table
- Sample script that displays all of the users in a given SQL Server DB
- MySQL Error Query database. Causejava.sql.SQLException: Incorrect key file for table ‘/tmp/#sql_181c
- MCITP SQL Server 2005 Database Developer All-in-One Exam Guide
- Sample script that deletes a SQL Server database
- SqlServer IF Exists([database]|[table]|[prop]) / Column([Operation])
- SQL logic error or missing database no such table: xxx
- 从数据库表中检索所有行20.5.4.Retrieving All Rows from a Database Table
- 转:Move all SQL Server system databases at one time
- CDH5..4.7+phoenix实现查询HBase异常:java.sql.SQLException: ERROR 1102 (XCL02): Cannot get all table regions
- SQL INSERT INTO TABLE SELECT指定插入字段的新用法
- Generate class from database table How can i generate a class from a table at a SQL Server?
- Csharp run sql script create database
- How to Kill All Processes That Have Open Connection in a SQL Server Database[关闭数据库链接 最佳方法] -摘自网络
- mybatis中insert into ...select ...from dual union all select ... from dual 提示sql命令未结束的问题
- SQL Server Create/Update/Delete/Select Table/View/Procedure常见用法