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
相关文档:
测试的时候比较重要,我们可以知道当前交易影响了哪些表
--用于记录用户在当前表上什么时候、做的什么操作:update、insert、delete
create table TriggerRecord
(
operdt datetime, --触发时间
opertp varchar(10), --操作类型:update、insert、delete
opertb varchar(50) --表名 ......
1.SQLServer的创建脚本如下:
USE [master]
GO
/****** Object: Database [test] Script Date: 10/29/2009 17:43:10 ******/
CREATE DATABASE [test] ON PRIMARY
( NAME = N'test', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test.mdf' , S ......
转载自:http://sunfreesky.blog.163.com/blog/static/211116820097224822596/
SQLServer安装程序配置服务器失败.参考服务器错误日志和c:\windows\sqlstp.log了解更多信息”错误
2007年07月15日 星期日 16:25
SQL 2000 安装程序配置服务器失败解决方法:
日志文件引用内容:
13:09:40 Process Ex ......
一、数据库结构的设计
如果不能设计一个合理的数据库模型,不仅会增加客户端和服务器段程序的编程和维护的难度,而且将会影响系统实际运行的性能。所以,在一个系统开始实施之前,完备的数据库模型的设计是必须的。
在一个系统分析、设计阶段,因为数据量较小,负荷较低。我们往往 ......
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 ......