易截截图软件、单文件、免安装、纯绿色、仅160KB

SqlServer中自定义类似Split截取字段函数

if exists (select * from dbo.sysobjects where name='SplitStr' )
drop FUNCTION SplitStr
go
CREATE   FUNCTION   SplitStr   (@splitString   varchar(8000),   @separate   varchar(10))  
RETURNS   @returnTable   table(col_Value   varchar(20))  
AS  
BEGIN  
declare   @thisSplitStr   varchar(20)  
declare   @thisSepIndex   int  
declare   @lastSepIndex   int  
set   @lastSepIndex   =   0  
if   Right(@splitString   ,len(@separate))   <>   @separate   set   @splitString   =   @splitString   +   @separate  
set   @thisSepIndex   =   CharIndex(@separate,@splitString   ,@lastSepIndex)  
while   @lastSepIndex   <=   @thisSepIndex  
begin  
                set   @thisSplitStr   =   SubString(@splitString   ,@lastSepIndex,@thisSepIndex-@lastSepIndex)  
                set   @lastSepIndex   =   @thisSepIndex   +   1  
                set   @thisSepIndex   =   CharIndex(@separate,@splitString   ,@lastSepIndex)  
                insert   into   @returnTable   values(@thisSplitStr)  
end&n


相关文档:

SQLServer中对所有的用户表生成触发器

测试的时候比较重要,我们可以知道当前交易影响了哪些表
--用于记录用户在当前表上什么时候、做的什么操作:update、insert、delete
create table TriggerRecord
(
 operdt datetime, --触发时间
 opertp varchar(10), --操作类型:update、insert、delete
 opertb varchar(50) --表名 ......

为SQLServer表中的字段添加说明

在SQL语句中通过系统存储过sp_addextendedproperty可为表字段添加上动态的说明(备注)下面是SQL SERVER帮助文档中对sp_addextendedproperty存储过程的描述
语法
sp_addextendedproperty
    [ @name = ] { 'property_name' }
    [ , [ @value = ] { 'value' }
   &nbs ......

ORACLE临时表和SQLSERVER临时表异同

 SQL SERVER临时表
也可以创建临时表。临时表与永久表相似,但临时表存储在 tempdb 中,当不再使用时会自动删除。
有本地和全局两种类型的临时表,二者在名称、可见性和可用性上均不相同。本地临时表的名称以单个数字符号 (#) 打头;
它们仅对当前的用户连接是可见的;当用户从 Microsoft? SQL Server? 2000 实例断 ......

如何解决SQLServer占内存过多的问题

  经常看见有人问,MSSQL占用了太多的内存,而且还不断的增长;或者说已经设置了使用内存,可是它没有用到那么多,这是怎么一回事儿呢?
  首先,我们来看看MSSQL是怎样使用内存的。
  最大的开销一般是用于数据缓存,如果内存足够,它会把用过的数据和觉得你会用到的数据统统扔到内存中,直到内存不足的时候 ......

sqlServer 中 获取汉字字串的拼音声母

 CREATE        function fGetPy(@str varchar(500)='')
returns varchar(500)
as
begin
    declare @strlen int,@return varchar(500),@ii int
    declare @c nchar(1),@chn nchar(1)
    select @strlen=len(@str),@retur ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号