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
相关文档:
数据库字典包括表结构(分2K和2005)、索引和主键.外键.约束.视图.函数.存储过程.触发器.规则。可以在企业管理器、查询分析器中简单执行,直接了当的查出SQL2K及SQL2005的所有数据字典,方便文档的编写,希望对大家有帮助。
1. SqlServer2000数据库字典--表结构.sql
SELECT TOP 100 PERCENT --a.id,
& ......
选择指定条数语句:
db2:select * from tabname fetch frist n rows only
informix:select first n *
from tabname
oralce:select * from tabname where rownum <= n
sql server :select top n * from tabname ......
触发器的定义与分类:
只要触发器所在表上的对应时间发生,就会自动执行该触发器的代码.实际上,我们并不能直接调用触发器,唯一的方法是在分配哦触发器的表上执行某种行为方可激活触发器. [触发器是一种特殊的存储过程,他在执行特定的语言事件时生效
& ......
1.建表(Create table)时使用 IDENTITY (SEED,INCREMENT)
其中SEED是起始值,INCREMENT是增量。
例:
CREATE TABLE mytable1
(
[user_id] BIGINT NOT NULL
IDENTITY(1, 1) ,
......