SQL自定义快捷键
来源:互联网 发布:淘宝宝贝违规被下架 编辑:程序博客网 时间:2024/06/05 05:39
if exists(select 1 from SysObjects where xtype = 'P' and name = 'sp_Insert')
drop proc sp_Insert
Go
--Ctl + 4
CREATE proc sp_Insert
@table varchar(100)
as
declare @str varchar(8000)
set @str='insert '+@table+'('
--select * from syscolumns where id=object_id('sfcprwipd_mstr')
select @str=@str+[name]+',' from syscolumns where id=object_id(@table)
order by colorder
set @str=left(@str,len(@str)-1)+')'
print @str
Go
if exists(select 1 from SysObjects where xtype = 'P' and name = 'sp_Select')
drop proc sp_Select
Go
--Ctl + 3
Create proc sp_Select
@table varchar(100)
as
exec('select * from '+@table)
Go
if exists(select 1 from SysObjects where xtype = 'P' and name = 'sp_TableConstruction')
drop proc sp_TableConstruction
Go
--Ctl + 5
Create proc sp_TableConstruction
@table varchar(100)
as
declare @tmp table
(
Column_name varchar(50),
Type varchar(50),
Lenght int,
Scale varchar(5),
Nullable varchar(1),
Defaults varchar(4000),
PrimaryKey varchar(1)
)
insert @tmp (Column_name, Type, Lenght, Scale, Nullable, Defaults,PrimaryKey)
select a.name, c.name, a.length, case when c.name <> 'datetime' then isnull(a.scale,'') else '' end,
case a.isnullable when 0 then 'N' else 'Y' end, isnull(d.text,''), case when x.PrimaryKey is null then '' else x.PrimaryKey end
from SysColumns a with(nolock)
inner join (select * from SysObjects with(nolock) where xtype = 'U' and id = object_id(@table)) b on a.id = b.id
inner join SysTypes c with(nolock) on a.xtype = c.xusertype
left join syscomments d with(nolock) on a.cdefault = d.id
left join
(select f.id, colid, 'Y' as PrimaryKey from SysIndexKeys f with(nolock), SysIndexes e, SysObjects g
where f.id = e.id and f.indid = e.indid and f.id = g.parent_obj and e.name = g.name
and g.xtype = 'PK' and g. parent_obj = object_id(@table)) x on a.id = x.id and a.colid = x.colid
update @tmp set Scale = '' where Scale = '0'
select * from @tmp
Go
- SQL自定义快捷键
- sql server 自定义快捷键
- SQL Server 自定义快捷键。
- pl/sql developer自定义快捷键
- SQL Server Management Studio自定义快捷键
- SQL Server Management Studio自定义快捷键
- SQL快捷键,VS快捷键
- sql快捷键
- SQL快捷键
- SQL快捷键
- sql 快捷键
- vim自定义命令,自定义快捷键
- PL/SQL 自定义快捷键(比如输入s,直接就显示select * from)
- 自定义PowerPCB的快捷键
- VC自定义热键,快捷键
- Web页面快捷键自定义
- PPStream自定义快捷键
- Word自定义快捷键
- 为何而来
- 你是“汉堡人才”吗?
- lucene3.0分词结果显示
- 技术越来越厉害啦。电视能直接摄像。
- Erlang简介
- SQL自定义快捷键
- JDBC_1_2010_03_21(补)
- 80386虚模式内存管理(2)
- google退出中国市场——g迷怎么办
- Zigbee网络基本知识小总结
- delphi 调用 dll
- Android教程之MediaStore
- commons fileupload 相关的代码
- 利用 ISAPI Rewrite 做网站301永久重定向