加载中…
  
博文
标签:

it

分类: MY-ORACLE
引用地址:http://www.ecdoer.com/post/oracle-startup.html

先来简要了解一下Oracle数据库体系架构以便于后面深入理解,Oracle Server主要由实例(instance数据库(database组成。实例(instance共享内存(SGA后台进程系统组成,数据库(database是存储在磁盘上的一系列物理文件。

http://www.ecdoer.com/wp-content/upload

(2018-03-19 15:40)
标签:

it

分类: MY-ORACLE
重建索引命令
1、alter index index_name rebuild tablespace tablespace_name 

2、查询索引
select index_name,tablespace_name from user_indexes

3、批量生成重建索引脚本命令
标签:

it

分类: MY-SQLServer
 a.bat 

  @echo off sqlcmd -U sa -P aaa -i C:\Users\Administrator\Desktop\1.sql pause 

  

标签:

it

分类: MY-SQLServer
参考地址:http://blog.csdn.net/yuemingfuyueming/article/details/73481397
if not exists(select 1 from sys.servers where name='DBVIP') begin
标签:

it

分类: MY-ORACLE
  直接套用,修改表名和字段名。      

 (SELECT names,  
          count1,
          substr(replace(contents,'◆',','),l,instr(replace(contents,'◆',',')||',',',',l)-l) as ExamItem
          from 
              (select aaa.ExamItem AS contents,COUNT(1)  as count1,aaa.name as names from 
               aaa having count(1)>=1 group by  aaa.ExamItem,aaa.name )A
               ,((SELECT LEVEL l FROM DUAL CONNECT BY LEVEL <=(select max((length(name)) - LENGTH(REGEXP_REPLACE(REPLACE(name, '◆', '@'),  '[^@]+',  ''))) from aaa)))
               WHERE substr(','||replace(contents,'
标签:

it

分类: MY-SQLServer
参考地址:http://bbs.csdn.net/topics/390216523
参考语句:
if object_id('[aaa]') is not null drop table [aaa]
go
create table [aaa]([地区] varchar(4),[内容] varchar(45))
insert [aaa]
select '中国','021sp.html|管材|4355;028sp.html|建筑材料|3209' union all
select '中国','023sp.html|材|4356;025sp.html|建|9209'
go

select  a.地区,
 内容=substring(a.内容,b.number,charindex(';',a.内容+';',b.number)-b.number)
from [aaa] a
join master..spt_values b on b.type='P'
where charindex(';',';'+a.内容,b.number)=b.number



select procedurexname as '方法',examitem as '项目',count(tid) as '人次'
from ( select  exam.procedurexname as procedurexname,exam.TID as tid,    
标签:

it

分类: MY-SQLServer
--出参值说明
--@feedback=1 报告更新虚拟打印状态
--@feedback=2 图像更新虚拟打印状态
--@feedback=3 报告图像同时更新虚拟打印状态
--@feedback=4 @examtid传值为空
--@feedback=5 数据库中未查询到exam.tid=@examtid的记录
--@feedback=6 @VirtualReportPrintStatus和@VirtualFilmStatus传值均为空
--@feedback=7 @VirtualReportPrintStatus或者@VirtualFilmStatus传如非法值
--存储过程
create proc UpdateExamVirtualStatus
@examtid int,
@VirtualReportPrintStatus int,
@VirtualFilmStatus int,  (入参)
@feedback int output   (出参)
as
if(@examtid is null or @examtid='' or @examtid=' ')   (或判断)
begin
set @feedback=4  (设置出参值)
return @feedback  
标签:

it

分类: MY-SQLServer
1、ALTER view test1 as 
select NAME AS NAMEINT,AGE AS AGEINT FROM TEST (name保持表中类型)

2、sp_help  test1

NAMEINT     varchar      no 50         yes no yes Chinese_PRC_CI_AS
AGEINT         int               no 4 10   0     yes (n/a) (n/a) NULL

1、ALTER view test1 as 
select CAST(NAME AS INT) AS NAMEINT,AGE AS AGEINT FROM TEST  (将varchar类型改为int类型)

标签:

it

分类: MY-SQLServer
1、查询前30天的数据,如果DateTime为字符串型,则需要将getdate()获取到的日期型通过convert转换为字符串型(查询前五天则将30改成5):
select * from table where
DateTime>CONVERT(varchar(100), dateadd(day,-30,GETDATE()), 112)

参考地址:http://www.ablanxue.com/prone_10028_1.html
                  http://www.cnblogs.com/zhangq723/archive/2011/02/16/1956152.html

用sql查询当天,一周,一个月的数据
 
标签:

it

分类: MY-SQLServer
ltrim(Convert(numeric(9,2),Result*100.0/tid))as '概率':

numeric(9,2):字段为数字型,长度为9,小数为2位

Convert(numeric(9,2),Result*100.0/tid)
SELECT CONVERT(decimal(9,2), '123.4')
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有