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
相关文档:
进来因为开发原因,经常需要使用日期方面的比较和操作,整理了一下这方面的资料,供大家共享:
SQL Server中文版的默认的日期字段datetime格式是yyyy-mm-dd Thh:mm:ss.mmm
例如:
select getdate()
2004-09-12 11:06:08.177
整理了一下SQL Server里面可能经常会用到的日期格式转换方法:
举例如下:
select CONVE ......
Access、SQLServer、Oracle常见SQL语句应用区别
关劲松 PMP
如果要兼容Access、SQL Server、Oracle三个数据库版本;我们在编写SQL语句的过程中,尽量使用一些通用的语句,但还是有些方面有些区别避免不了,现简单总结一下。
以下A代表Access,S代表SQL Server,O代表Oracle
1、取当前系统时间
A:Select Now()
S:Selec ......
如何开启SQLSERVER数据库缓存依赖优化网站性能
数据库, 缓存, SQLSERVER, 性能
很多时候,我们服务器的性能瓶颈会是在查询数据库的时候,所以对数据库的缓存非常重要,那么有没有一种方法,可以实现SQL SERVER数据库的缓存,当数据表没有更新时,就从缓存中读取,当有更新的时候,才从数据表中读取呢,答案是肯定的,这 ......
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 ......
1.建表(Create table)时使用 IDENTITY (SEED,INCREMENT)
其中SEED是起始值,INCREMENT是增量。
例:
CREATE TABLE mytable1
(
[user_id] BIGINT NOT NULL
IDENTITY(1, 1) ,
......