sqlserver 2005 split function
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
create function [dbo].[split](@str nvarchar(1000),@word varchar(5),@no
int) returns nvarchar(500)
as begin
declare @len int
declare @index int
set @index=charindex(@word,@str)
set @index=len(@word)+@index-1
set @len=len(@str)
if @index >0 and @no=2
return substring(@str,@index+1,@len)
else if @index>0 and @no=1
return substring(@str,0,@index-len(@word)+1)
return @str
end
相关文档:
方式一:
select top 200 * from view_OrganResource
where 1=1 and OrganID = 57 and
(OrderID not in(select top 1000 OrderID from tb_OrganResource
where 1=1 and OrganID = 57 order by uploadtime desc))
order by uploadtime desc --5858 1980
方式二:
select top 200 * from
vi ......
游标操作的六步骤:
◆在每次在创建游标的时候都问问自己,用什么别的方法可以避免使用游标,那么你就步如设计的正规了.
1.声明
2.打开
3.应用/操作
4.关闭.
5.释放
&nbs ......
1
.绝对值
S:
select
abs
(
-
1
) value
O:
select
abs
(
-
1
) value
from
dual
2
.取整(大)
S:
select
ceiling
(
-
1.001
) value
O:
select
ceil(
-
1.001
) value
from
d ......
现象:
现在做一个程序,对数据库的几个装有大量数据的表进行操作,对其中的一个表进行
循环操作,以处理其他的几个表。其中用到了几个query,update,当程序跑的过程中,
SQLSERVER的内存不断的增长,跑完后关闭程序退出后也不降下来。
解决:
这是SQL的内存管理机制决定的,SQL管理内存的原则是这样的,只要你的内存够 ......
1.建表(Create table)时使用 IDENTITY (SEED,INCREMENT)
其中SEED是起始值,INCREMENT是增量。
例:
CREATE TABLE mytable1
(
[user_id] BIGINT NOT NULL
IDENTITY(1, 1) ,
......