一些有用的SQL Server语句和存储过程

SQL Server存储过程中执行动态SQL语句 一、简介      在Sql Server中执行动态sql语句有两种方法:exec和exec sp_executesql。      优缺点: 1、exec sp_executesql提供输入、输出接口,可以在sql语句中进行参数占位;exec则不可以。 2、exec sp_executesql能够重用执行计划,提高了执行效率;exec则不可以。 3、exec sp_executesql更安 阅读详情
  1-- ======================================================
  2
  3--列出SQL SERVER 所有表,字段名,主键,类型,长度,小数位数等信息
  4
  5--在查询分析器里运行即可,可以生成一个表,导出到EXCEL中
  6
  7-- ======================================================
  8
  9Select 
 10
 11       (Case When A.Colorder=1 Then D.Name Else '' End)表名,
 12
 13       A.Colorder 字段序号,
 14
 15       A.Name 字段名,
 16
 17       (Case When Columnproperty( A.Id,A.Name,'Isidentity')=1 Then '√'Else '' End) 标识,
 18
 19       (Case When (Select Count(*)
 20
 21       From Sysobjects
 22
 23       Where (Name In
 24
 25                 (Select Name
 26
 27                From Sysindexes
 28
 29                Where (Id = A.Id) And (Indid In
 30
 31                          (Select Indid
 32
 33                         From Sysindexkeys
 34
 35                         Where (Id = A.Id) And (Colid In
 36
 37                                   (Select Colid
 38
 39                                  From Syscolumns
 40
 41                                  Where (Id = A.Id) And (Name = A.Name))))))) And
 42
 43              (Xtype = 'Pk'))>0 Then '√' Else '' End) 主键,
 44
 45       B.Name 类型,
 46
 47       A.Length 占用字节数,
 48
 49       Columnproperty(A.Id,A.Name,'Precision') As 长度,
 50
 51       Isnull(Columnproperty(A.Id,A.Name,'Scale'),0) As 小数位数,
 52
 53       (Case When A.Isnullable=1 Then '√'Else '' End) 允许空,
 54
 55       Isnull(E.Text,'') 默认值,
 56
 57       Isnull(G.[Value],'') As 字段说明    
 58
 59From  Syscolumns  A Left Join Systypes B 
 60
 61On  A.Xtype=B.Xusertype
 62
 63Inner Join Sysobjects D 
 64
 65On A.Id=D.Id  And  D.Xtype='U' And  D.Name<>'Dtproperties'
 66
 67Left Join Syscomments E
 68
 69On A.Cdefault=E.Id
 70
 71Left Join Sysproperties G
 72
 73On A.Id=G.Id And A.Colid = G.Smallid  
 74
 75Order By A.Id,A.Colorder
 76
 77列出SQL SERVER 所有表、字段定义,类型,长度,一个值等信息
 78
 79并导出到Excel 中
 80
 81-- ======================================================
 82
 83-- Export all user tables definition and one sample value
 84
 85-- jan-13-2003,Dr.Zhang
 86
 87-- ======================================================
 88
 89在查询分析器里运行:
 90
 91SET ANSI_NULLS OFF 
 92
 93GO
 94
 95SET NOCOUNT ON
 96
 97GO
 98
 99 
100
101SET LANGUAGE 'Simplified Chinese'
102
103go
104
105DECLARE @tbl nvarchar(200),@fld nvarchar(200),@sql nvarchar(4000),@maxlen int,@sample nvarchar(40)
106
107 
108
109SELECT d.name TableName,a.name FieldName,b.name TypeName,a.length Length,a.isnullable IS_NULL INTO #t
110
111FROM  syscolumns  a,  systypes b,sysobjects d  
112
113WHERE  a.xtype=b.xusertype  and  a.id=d.id  and  d.xtype='U' 
114
115 
116
117DECLARE read_cursor CURSOR
118
119FOR SELECT TableName,FieldName FROM #t
120
121 
122
123SELECT TOP 1 '_TableName                     ' TableName,
124
125            'FieldName                      ' FieldName,'TypeName             ' TypeName,
126
127            'Length' Length,'IS_NULL' IS_NULL, 
128
129            'MaxLenUsed' AS MaxLenUsed,'Sample Value          ' Sample,
130
131             'Comment   ' Comment INTO #tc FROM #t
132
133 
134
135OPEN read_cursor
136
137 
138
139FETCH NEXT FROM read_cursor INTO @tbl,@fld
140
141WHILE (@@fetch_status <> -1)  --- failes
142
143BEGIN
144
145       IF (@@fetch_status <> -2) -- Missing
146
147       BEGIN
148
149              SET @sql=N'SET @maxlen=(SELECT max(len(cast('+@fld+' as nvarchar))) FROM '+@tbl+')'
150
151              --PRINT @sql
152
153              EXEC SP_EXECUTESQL @sql,N'@maxlen int OUTPUT',@maxlen OUTPUT
154
155              --print @maxlen
156
157              SET @sql=N'SET @sample=(SELECT TOP 1 cast('+@fld+' as nvarchar) FROM '+@tbl+' WHERE len(cast('+@fld+' as nvarchar))='+convert(nvarchar(5),@maxlen)+')'
158
159              EXEC SP_EXECUTESQL @sql,N'@sample varchar(30) OUTPUT',@sample OUTPUT
160
161              --for quickly   
162
163              --SET @sql=N'SET @sample=convert(varchar(20),(SELECT TOP 1 '+@fld+' FROM '+
164
165                     --@tbl+' order by 1 desc ))'  
166
167              PRINT @sql
168
169              print @sample
170
171              print @tbl
172
173              EXEC SP_EXECUTESQL @sql,N'@sample nvarchar(30) OUTPUT',@sample OUTPUT
174
175              INSERT INTO #tc SELECT *,ltrim(ISNULL(@maxlen,0)) as MaxLenUsed,
176
177                     convert(nchar(20),ltrim(ISNULL(@sample,' '))) as Sample,' ' Comment FROM #t where TableName=@tbl and FieldName=@fld
178
179       END
180
181       FETCH NEXT FROM read_cursor INTO @tbl,@fld
182
183END
184
185 
186
187CLOSE read_cursor
188
189DEALLOCATE read_cursor
190
191GO
192
193 
194
195SET ANSI_NULLS ON
196
197GO
198
199SET NOCOUNT OFF
200
201GO
202
203select count(*)  from #t
204
205DROP TABLE #t
206
207GO
208
209 
210
211select count(*)-1  from #tc
212
213 
214
215select * into ##tx from #tc order by tablename
216
217DROP TABLE #tc
218
219 
220
221--select * from ##tx
222
223 
224
225declare @db nvarchar(60),@sql nvarchar(3000)
226
227set @db=db_name()
228
229--请修改用户名和口令 导出到Excel 中
230
231set @sql='exec master.dbo.xp_cmdshell ''bcp ..dbo.##tx out c:/'+@db+'_exp.xls -w -C936 -Usa -Psa '''
232
233print @sql
234
235exec(@sql)
236
237GO
238
239DROP TABLE ##tx
240
241GO
242
243 
244
245 
246
247 
248
249-- ======================================================
250
251--根据表中数据生成insert语句的存储过程
252
253--建立存储过程,执行 spGenInsertSQL 表名
254
255--感谢playyuer
256
257-- ======================================================
258
259CREATE   proc spGenInsertSQL (@tablename varchar(256))
260
261 
262
263as
264
265begin
266
267  declare @sql varchar(8000)
268
269  declare @sqlValues varchar(8000)
270
271  set @sql =' ('
272
273  set @sqlValues = 'values (''+'
274
275  select @sqlValues = @sqlValues + cols + ' + '','' + ' ,@sql = @sql + '[' + name + '],' 
276
277    from 
278
279        (select case 
280
281                  when xtype in (48,52,56,59,60,62,104,106,108,122,127)                                
282
283                       then 'case when '+ name +' is null then ''NULL'' else ' + 'cast('+ name + ' as varchar)'+' end'
284
285                  when xtype in (58,61)
286
287                       then 'case when '+ name +' is null then ''NULL'' else '+''''''''' + ' + 'cast('+ name +' as varchar)'+ '+'''''''''+' end'
288
289                 when xtype in (167)
290
291                       then 'case when '+ name +' is null then ''NULL'' else '+''''''''' + ' + 'replace('+ name+','''''''','''''''''''')' + '+'''''''''+' end'
292
293                  when xtype in (231)
294
295                       then 'case when '+ name +' is null then ''NULL'' else '+'''N'''''' + ' + 'replace('+ name+','''''''','''''''''''')' + '+'''''''''+' end'
296
297                  when xtype in (175)
298
299                       then 'case when '+ name +' is null then ''NULL'' else '+''''''''' + ' + 'cast(replace('+ name+','''''''','''''''''''') as Char(' + cast(length as varchar)  + '))+'''''''''+' end'
300
301                  when xtype in (239)
302
303                       then 'case when '+ name +' is null then ''NULL'' else '+'''N'''''' + ' + 'cast(replace('+ name+','''''''','''''''''''') as Char(' + cast(length as varchar)  + '))+'''''''''+' end'
304
305                  else '''NULL'''
306
307                end as Cols,name
308
309           from syscolumns  
310
311          where id = object_id(@tablename) 
312
313        ) T 
314
315  set @sql ='select ''INSERT INTO ['+ @tablename + ']' + left(@sql,len(@sql)-1)+') ' + left(@sqlValues,len(@sqlValues)-4) + ')'' from '+@tablename
316
317  --print @sql
318
319  exec (@sql)
320
321end
322
323 
324
325GO
326
327 
328
329 
330
331 
332
333-- ======================================================
334
335--根据表中数据生成insert语句的存储过程
336
337--建立存储过程,执行 proc_insert 表名
338
339--感谢Sky_blue
340
341-- ======================================================
342
343 
344
345CREATE proc proc_insert (@tablename varchar(256))
346
347as
348
349begin
350
351       set nocount on
352
353       declare @sqlstr varchar(4000)
354
355       declare @sqlstr1 varchar(4000)
356
357       declare @sqlstr2 varchar(4000)
358
359       select @sqlstr='select ''insert '+@tablename
360
361       select @sqlstr1=''
362
363       select @sqlstr2=' ('
364
365       select @sqlstr1= ' values ( ''+'
366
367       select @sqlstr1=@sqlstr1+col+'+'',''+' ,@sqlstr2=@sqlstr2+name +',' from (select case 
368
369--     when a.xtype =173 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
370
371       when a.xtype =104 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(1),'+a.name +')'+' end'
372
373       when a.xtype =175 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
374
375       when a.xtype =61  then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
376
377       when a.xtype =106 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
378
379       when a.xtype =62  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
380
381       when a.xtype =56  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(11),'+a.name +')'+' end'
382
383       when a.xtype =60  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
384
385       when a.xtype =239 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
386
387       when a.xtype =108 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end'
388
389       when a.xtype =231 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
390
391       when a.xtype =59  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end'
392
393       when a.xtype =58  then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end'
394
395       when a.xtype =52  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(12),'+a.name +')'+' end'
396
397       when a.xtype =122 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end'
398
399       when a.xtype =48  then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(6),'+a.name +')'+' end'
400
401--     when a.xtype =165 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end'
402
403       when a.xtype =167 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end'
404
405       else '''NULL'''
406
407       end as col,a.colid,a.name
408
409       from syscolumns a where a.id = object_id(@tablename) and a.xtype <>189 and a.xtype <>34 and a.xtype <>35 and  a.xtype <>36
410
411       )t order by colid
412
413       
414
415       select @sqlstr=@sqlstr+left(@sqlstr2,len(@sqlstr2)-1)+') '+left(@sqlstr1,len(@sqlstr1)-3)+')'' from '+@tablename
416
417--  print @sqlstr
418
419       exec( @sqlstr)
420
421       set nocount off
422
423end
424
425GO
执行存储过程和SQL语句的写法(SQL Server) 在上面的命令中,将"“替换为SQL Server的名称,”"替换为要连接的数据库的名称。在上面的命令中,将"“替换为SQL Server的名称,”"替换为要连接的数据库的名称。要执行SQL语句,只需在查询窗口中输入相应的SQL语句,然后按下执行按钮(或者使用快捷键F5)即可。在上面的示例中,我们将@CustomerId参数的值设置为1,并执行了"GetCustomerDetails"存储过程。 阅读详情

相关推荐

自动生成SQL Server中的INSERT语句的存储过程

在SQL Server数据库中,存储过程是一种可重复使用的数据库对象,用于执行一系列预定义的操作。本文将介绍如何编写一个存储过程,用于自动生成INSERT语句,并提供相应的源代码示例。这只是一个演示目的,实际上你可以根据需要将其用于其他操作,例如执行生成的INSERT语句或将其存储到表中。首先,我们需要创建一个存储过程,用于接收表名和列名作为参数,并根据这些参数生成INSERT语句。运行上述代码后,存储过程将生成相应的INSERT语句,并将其打印输出到消息窗口中。是要插入的列名列表,以逗号分隔。

ElServer的博客 456

SQL Server 2012 存储过程

文章目录1.存储过程2.无参存储过程3.带入参存储过程4.带出参存储过程5.修改存储过程6.查看存储过程7.删除存储过程 1.存储过程 存储过程是由过程化SQL语句书写的过程,这个过程经过编译和优化后存储在数据库服务器中,因此称它为存储过程,使用时只要调用即可。使用存储过程可以实现代码的复用、提高运行效率、降低通信流量以及方便实施业务规则。 1.系统存储过程: SQL Server内置存储过程,...

柚子君的小窝 3835

FPGA_adc采样并通过以太网发送到上位机

本项目使用FPGA-ZYNQ-7020采集8通道ADC数据,通过以太网上传到上位机显示波形PL部分包括数据的获取与处理,数据从PL传递到PSPS部分包括以太网的发送,由PL到PS的中断触发本文章不详细讲解背后原理 但保证每一步足够详细,跟着就能实现。本人FPGA平台 大磊FPGA7020开发板 vivado2020.2 vitis2020.2 匿名上位机公开版

weixin_42304868的博客 5637

SqlServer 比较有用的系统存储过程

Use master go xp_readerrorlog go 读取服务启动日志 exec sp_addlinkedserver '链接服务器名称' , '未知待查' , 'SQLOLEDB' , '服务器IP' go exec sp_addlinkedsrvlogin 'mzlis' , 'false' , null , '用户名' , '密码' 添加链接服务器 如果

蝴蝶君的记事本 587

文件上传漏洞攻击与防范方法

文件上传漏洞攻击与防范方法 文件上传漏洞简介: 文件上传漏洞是web安全中经常用到的一种漏洞形式。是对数据与代码分离原则的一种攻击。上传漏洞顾名思义,就是攻击者上传了一个可执行文件如木马,病毒,恶意脚本,WebShell等到服务器执行,并最终获得网站控制权限的高危漏洞。 文件上传漏洞危害: 上传漏洞与SQL注入或 XSS相比 , 其风险更大 , 如果 Web应用程序存在上传漏洞 , 攻击者上传...

m0_38103658的博客 4万+

告别谷歌翻译失效!手把手教你用Immersive Translate插件实现双语网页阅读(附Chrome/Edge/Firefox保姆级配置)

本文详细介绍了如何使用Immersive Translate插件实现双语网页阅读,解决谷歌翻译失效的问题。通过Chrome、Edge和Firefox的保姆级配置指南,帮助用户轻松安装和使用这款支持双语对照、智能识别网页内容的翻译插件,提升外文资料阅读效率。

weixin_28683689的博客 498

收藏几段SQL Server语句和存储过程

收藏几段SQL  Server语句和存储过程 -- ======================================================--列出SQL SERVER 所有表,字段名,主键,类型,长度,小数位数等信息--在查询分析器里运行即可,可以生成一个表,导出到EXCEL中-- =====================================

清清海水 760

【ATC/DTC方法第四期】GOT09-dT-tao 昼夜温度周期模型方法介绍(含Python代码实现)

GOT09-dT-tao 模型是一种经过简化和参数固定的 昼夜温度周期模型(Diurnal Temperature Cycle, DTC)。它从 GOT09 模型(Göttsche and Olesen, 2009)衍生而来,但更加轻量化,更适合在数据不足或参数估计困难的情境下使用。

WW、forever的博客 150

SQL Server中存储过程比直接运行SQL语句慢的原因

 在很多的资料中都描述说SQLSERVER的存储过程较普通的SQL语句有以下优点:1.       存储过程只在创造时进行编译即可,以后每次执行存储过程都不需再重新编译,而我们通常使用的SQL语句每执行一次就编译一次,所以使用存储过程可提高数据库执行速度。 2.       经常会遇到复杂的业务逻辑和对数据库的操作,这个时候就会用SP来封装数据库操作。当对数据库进行复杂操作时(如对多个表进

sfz_roger的专栏 790

实现画布拖拽算子排布,通过flink实现算子编排计算,如何实现?

🏆本文收录于 《全栈 Bug 调优(实战版)》 专栏。专栏聚焦真实项目中的各类疑难 Bug,从成因剖析 → 排查路径 → 解决方案 → 预防优化全链路拆解,形成一套可复用、可沉淀的实战知识体系。无论你是初入职场的开发者,还是负责复杂项目的资深工程师,都可以在这里构建一套属于自己的「问题诊断与性能调优」方法论,助你稳步进阶、放大技术价值 。

**My Coding Family** 1075

uni-app - 解决 H5 微信公众号授权登录后,无法回退到 “上一页“ 的问题(微信登录后如何返回到触发它的那一页?无法通过 uni.navigateBack() 返回到前一页的问题?)详细教程

uniappH5微信登录重定向后无法返回到原来进入前的页面了,uni-appH5微信浏览器中授权微信登录后,无法正常回退问题,uniappH5微信登录后怎么返回上一页,uniapp公众号登陆后使用uni.navigateBack()回不去上一页,uniapp微信登录成功后返回页面后一直自动刷新页面,uniapph5授权成功后如何返回上一页,uniappH5微信登录后怎么返回到触发它的那一页去,公众号h5在授权后如何跳转回到刚进入时的页面,微信公众号H5网页返回上一页疑问,解决微信H5静默授

🏆 前端领域优质创作者 7727

SQL Server追踪StoredProcedure(存储过程)执行语句

VS上报出SqlException在系统上做一操作,需要在数据库上操作,但报出SqlException。如下图在下方的自动窗口中,可以找到当前执行的存储过程名称,以及执行这个存储过程所使用的参数的值。从上图可以看到,这个存储过程的名字是”SP_COM_APPLYAPPLICATION”。此时四个参数的值如下:@APPLYID : SQZL062016042000000003 @APPLYTYPEID

陀思妥耶夫斯基和海德格尔伴我勇敢存在 6408

SAP Word 模板与 ABAP XML 数据流合并机制深度解析

Office Open XML 标准把一个.docx拆分成多个部件(document.xml、customXml\item1.xml 等),天然支持命名空间与 XPath;Word 在渲染时,会扫描<w:sdt>(结构化文档标签)与来确定绑定关系;在 ABAP 端,通过简单字符串替换与 XSLT 变换即可完成数据灌入,无需 COM Automation,安全且易于调试。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 377

利用存储过程将SQL Server中的记录导出成SQl语句

1、执行存储过程后找到表数据 2、右键,另保存为txt 3、使用时导出的SQL语句时需要在insert后边加 into ———————————————————华丽的分割线—————————————————————   CREATE PROCEDURE  dbo.OutputData       @tablename  sysname       AS       declare

墨香 1051

LOFIC / 全局快门在移动端的可行性:曝光容限、读出噪声与算力预算

手机端引入 LOFIC 与全局快门的核心权衡在于:在有限像素面积与功耗下,如何换取更高的动态范围与运动场景鲁棒性。LOFIC 通过侧向溢流到积分电容扩大满井并保持较高转换增益,全局快门在帧内一次性采样消除行时序伪影,但需付出像素填充率、读出噪声与片上存储功耗的代价。本文以工程可实操为目标,给出像素与读出链的简化模型、曝光损益测算、数据率与带宽估算、端到端算力与热预算方法,配套寄存器配置流程、帧内/帧间切换策略与验证清单,帮助在真实移动 SoC 与 ISP 约束下完成可行性评估与原型落地。

努力分享一些人工智能、计算机视觉、影像等相关的知识干货! 1149

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

收藏几段SQL Server语句和存储过程

收藏几段SQL  Server语句和存储过程 -- ======================================================--列出SQL SERVER 所有表,字段名,主键,类型,长度,小数位数等信息--在查询分析器里运行即可,可以生成一个表,导出到EXCEL中-- ===========

no513的专栏 288

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

[转]SQL Server中存储过程比直接运行SQL语句慢的原因

原文地址:http://blog.csdn.net/emili/article/details/2192081 在很多的资料中都描述说SQLSERVER的存储过程较普通的SQL语句有以下优点: <!--[if !supportLists]-->1. <!--[endif]-->存储过程只在创造时进行编译即可,以后每次执行存储过程都不需再重新编译,而...

dengwen9264的博客 317

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

几段SQL Server语句和存储过程

几段SQL Server语句和存储过程document.title=" 收藏几段SQL Server语句和存储过程 - "+document.title 交叉表语句的实现:--用于:交叉表的列数是确定的select name,sum(case subject when 数学 then source else 0 end) as 数学,          sum(case sub

云中客的专栏 1247

SQL Server 2008下轻松调试T-SQL语句和存储过程

今天突然有同事问起,如何在sqlserver中调试存储过程(我们公司使用的是sqlserver 2008 R2),猛地一看,和以前使用sqlserver 2000真的有很大的不同,我真晕了。 于是琢磨了一下。SQLSERVER 2005中不知因何去掉了很重要的DEBUGGE

丁码农 8万+

Sql Server 获取存储过程或函数创建语句

通过该语句可以获取到sqlserver 所有的函数名或者存储过程名 SELECT name FROM sysobjects WHERE xtype='P'; 通过该语句可查询出函数或者存储过的的创建语句 sp_helptext '函数名(存储过程名)' xtype可选择类型 AF = 聚合函数 (CLR) C = CHECK 约束 D = DEFAULT(约束或独立) ...

weixin_30885111的博客 418
上一篇: Oracle中PL/SQL单行函数和组函数详解
下一篇: SQL Server 存储过程的分页方案比拼
AppleBBS
博客等级 码龄22年 415粉丝 803原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值