易截截图软件、单文件、免安装、纯绿色、仅160KB

工作中积攒的几个自定义SQL函数

    工作中积攒的几个自定义SQL函数:
-- =============================================
-- Author:  <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: 字符串切割函数
-- =============================================
ALTER function [dbo].[Split]
(
 @Text nvarchar(4000),
 @Sign nvarchar(4000)
)
returns  @tempTable table(id int identity(1,1) primary key,[value] nvarchar(4000))
AS
begin
     declare @StartIndex int                --开始查找的位置
     declare @FindIndex  int                --找到的位置
     declare @Content    varchar(4000)      --找到的值
     set @StartIndex = 1
     set @FindIndex=0
   
      --遍历每个字符
     while(@StartIndex <= len(@Text))
     begin
         SELECT @FindIndex = charindex(@Sign,@Text,@StartIndex)
         --判断有没找到 没找到返回0
        IF(@FindIndex =0 OR @FindIndex IS NULL)
        begin
            set @FindIndex = len(@Text)+1
        end
        set @Content = ltrim(rtrim(substring(@Text,@StartIndex,@FindIndex-@StartIndex)))
        set @StartIndex = @FindIndex+1
        insert into @tempTable ([value]) values (@Content)
     end
       return
end
-- ==========


相关文档:

JAVA连接ACCESS,SQL Server,MySQL,Oracle

import java.sql.*;
/*
* JAVA连接ACCESS,SQL Server,MySQL,Oracle数据库
*
* */
public class JDBC {
  
public static void main(String[] args)throws Exception {
  
   Connection conn=null;
  
       //====连接ACCESS数据库 ......

sql语句的使用

以下是我在学习中的点滴记录,如果有错误的地方或者缺少部分,请各位大侠不吝指教。小弟在此谢过了
1.select count(*) 和select count(id) 之间的区别。
select count(*) 统计所有记录个数,包括空记录。
Select count(Id) 统计所有记录个数,不包括null记录。
2.delete & truncate 的区别
trunc ......

PL/SQL 中 AutoReplace 配置

经常进行查询,写着select * from 太费时间,能不能直接输入一个s 就能自动出来 select * from 吗?
发现pl/sql中可以配置自动替换
在PL/SQL的安装目录下面:$\PLSQL Developer\PlugIns 中添加一个文本文件,比如命名为:AutoReplace.txt。文本文件中填写如下内容:
st = select t.* ,t.rowid from   t
s = se ......

SQl 语句(常见) 新建,删除,修改表结构

新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] Decimal (12,4) default 0,
[字段7] image null ,
)
删除表:
Drop table [表 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号