2015年11月12日

递归查询应用-公司股东层级分析

摘要: 1 2 3 4 5 6 7 8 9 10 CREATE proc [dbo].[公司股东层级分析] 11 12 @qymc nvarchar(400) 13 14 15 as 16 17 begin 18 19 if exists (select 企业名称 from dbo.工商登记明细 where 企... 阅读全文

posted @ 2015-11-12 15:43 lgq1978 阅读(439) 评论(0) 推荐(0) 编辑

生成数字+英文字母大小写彩虹字符集(6位),共有62^6种可能

摘要: --生成数字+英文字母大小写彩虹字符集(6位),共有62^6种可能 with cte as ( select number as ascii_no,CHAR(number) as ascii_char from master..spt_values where number between 48 and 57--0-9 ascii ... 阅读全文

posted @ 2015-11-12 15:40 lgq1978 阅读(687) 评论(0) 推荐(0) 编辑

一个比较笨的全文搜索的例子(分析结构用)-模糊查找

摘要: 1 2 3 4 --在所有的char类型的列中模糊查找某个值。 5 --**注意预先切换到当前的数据库中。 6 DECLARE @TABLE_CATALOG NVARCHAR(MAX)--数据库名 7 ,@TABLE_SCHEMA NVARCHAR(MAX)--架构名 8 ,@TABLE_NAME NVARCHAR(MAX)--表名 9 ,@COLUMN... 阅读全文

posted @ 2015-11-12 15:37 lgq1978 阅读(246) 评论(0) 推荐(0) 编辑

查询当前数据库中表的存储信息

摘要: declare @table_spaceused table (name nvarchar(100) ,rows int ,reserved nvarchar(100) ,data nvarchar(100) ,index_size nvarchar(100) ,unused nvarchar(100) ) insert into @table_space... 阅读全文

posted @ 2015-11-12 15:31 lgq1978 阅读(419) 评论(0) 推荐(0) 编辑

2015年11月11日

一个计算日期连续性的脚本

摘要: 1 USE [test] 2 GO 3 4 --一个计算日期连续性的脚本 5 --需求:查找指定天数的连续交易的记录,比如连续2天发生,连续3天发生等等。 6 /****** Object: Table [dbo].[liu_shui] Script Date: 11/11/2015 14:36:05 ******/ 7 SET ANSI_NULLS ON... 阅读全文

posted @ 2015-11-11 14:51 lgq1978 阅读(548) 评论(0) 推荐(0) 编辑

导航