工作中积攒的几个自定义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
-- ==========
相关文档:
一、SQL SERVER 和ACCESS的数据导入导出
常规的数据导入导出:
使用DTS向导迁移你的Access数据到SQL Server,你可以使用这些步骤:
○1在SQL SERVER企业管理器中的Tools(工具)菜单上,选择Data Transformation
○2Services(数据转换服务),然后选择 czdImport Dat ......
http://www.umgr.com/blog/PostView.aspx?bpId=36294
1. 执行sql语句
int sqlite3_exec(sqlite3*, const char *sql, sqlite3_callbacksql 语法
, void *, char **errmsg );
这就是执行一条 sql 语句的函数。
第1个参数不再说了,是前面open函数得到的指针。说了是关键数据结构。
第2个参数const char ......
select getdate()
是显示当前系统时间,输出的日期格式与本机日期格式有关,假入你想在什么情况下都显示成2006-12-15 10:37:00这种形式则需要转换一下
select convert(varchar(30),getdate(),20)
显示是星期几的语句是
select datename(weekday,getdate())
日期加星期的话直接加在一块就可以了
select convert(varcha ......
转自:http://www.orafaq.com/wiki/SQL*Loader_FAQ#How_can_one_get_SQL.2ALoader_to_COMMIT_only_at_the_end_of_the_load_file.3F
Contents
[hide
]
1
What is SQL*Loader and what is it used for?
2
How does one use the SQL*Loader utility?
3
How does one load MS-Excel data into Oracle?
4
Is ther ......
经常进行查询,写着select * from 太费时间,能不能直接输入一个s 就能自动出来 select * from 吗?
发现pl/sql中可以配置自动替换
在PL/SQL的安装目录下面:$\PLSQL Developer\PlugIns 中添加一个文本文件,比如命名为:AutoReplace.txt。文本文件中填写如下内容:
st = select t.* ,t.rowid from t
s = se ......