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
相关文档:
疑问:
1, sqlserver里面执行 xp_cmdshell
exec @error=xp_cmdshell 'cmdstr......'
返回值是什么值?dos命令的错误?什么样的错误可以扑捉到?
比如:
DECLARE @error int
EXEC @error=master.dbo.xp_cmdshell 'bcp CM_DWHSend.dbo.WK_CM_DWHSend_Master in "D:\Sales\DWH_Onl\2010042_SENDMEMM.csv" -n -t, - ......
select identity(int,1,1) as col_id , * into temp from uep.dbo.A_experiment
select * from temp where col_id between 50 and 60
drop table temp ......
如何开启SQLSERVER数据库缓存依赖优化网站性能
数据库, 缓存, SQLSERVER, 性能
很多时候,我们服务器的性能瓶颈会是在查询数据库的时候,所以对数据库的缓存非常重要,那么有没有一种方法,可以实现SQL SERVER数据库的缓存,当数据表没有更新时,就从缓存中读取,当有更新的时候,才从数据表中读取呢,答案是肯定的,这 ......
最近因为要写一个数据并发访问的控制程序,上网查了一些资料,现在归纳如下: 锁的概述 一. 为什么要引入锁
多个用户同时对数据库的并发操作时会带来以下数据不一致的问题:
丢失更新
A,B两个用户读同一数据并进行修改,其中一个用户的修改结果破坏了另一个修改的结 ......
本来我是不赞成使用通用存储过程的,主要是因为根据表结构来定制分页查询不用动态的拼SQL,这样才是真正的高效,而且只要写过一个,那么再有新需求的时候,小范围改动几处就ok了。
但总是有人向我讨要或者讨论通用存储过程,没办法,被逼无奈,良心丧与困境。
木有找到T-SQL代码编辑器
-- ============================= ......