Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

IIS网站文件夹权限配置
1,文件夹读权限:开通IIS匿名访问账号、应用程序池对应账号的读权限,(一般为NET WORK SERVICE.)
2, 对于需要写入的文文件夹,如文件上传,开通程序池对应账号的写权限,上传目录的IIS执行权限设为“无”
3,其它权限不开。
注:若不开IIS匿名访问账号的读权限,会报401权限错误。
若不开程序池对应账号的读权限 会报Server Application Unavailable错误。
若对于写文件夹,不开程序池对应账号的写权限,将不能写入。

注:
IIS 面板中的“写入”权限实际上是对 HTTP PUT 指令的处理,对于普通网站,一般情况下这个权限是不打开的。
IIS 面板中的“脚本资源访问”不是指可以执行脚本的权限,而是指可以访问源代码的权限,用webdav的客户端(IE)可以打开ASP文件,就直接看到源代码并且修改。


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

IIS网站配置:如网站所在目录、用了FrameWork哪个版本等信息。

一、IIS的备份

1.在本地计算机上的 IIS 管理单元中,右键单击 Internet 信息服务下面的计算机图标。

2.选择“所有任务\备份/还原配置”选项。

3.点击“创建备份”按钮,在配置备份名称下输入你为备份起的名字

4.将“使用密码加密备份”勾选上(如果在做备份的时候,没有将“使用密码加密备份”勾选上,那么在重新安装系统后或者在另外一台计算机上还原时会提示”无效的签名”)

.输入密码,备份完成。

注:备份后的备份文件在C:\WINDOWS\system32\inetsrv\MetaBack\ (X代表你安装系统的盘符)。

二、还原到其他服务器上:

将备份文件.sc0和.md0 copy到系统C:\WINDOWS\system32\inetsrv\MetaBack\目录下,右键单击 Internet 信息服务下面的计算机图标,执行还原操作。


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

c:\Program Files\Common Files\microsoft shared\OFFICE12

\Office Setup Controller\”,找到SETUP.EXE。重命名


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

总则:观察规律,将规律固定下来。
连续范围:1,2,3,4,7,8,11,12,15
连续范围为:1,2,3,4 | 7,8 |11,12
特点:若按从小到大的顺序给行号,则在连续范围中的与行号相减,应为一固定数值
如:
字段值 行号 相减值
1 1 0
2 2 0
3 3 0
4 4 0
7 5 2
8 6 2
11 7 4
12 8 4
15 9 6
相减值相对的是处于连续范围内,按此值分组,求最小字段值、最大字段值即是连续范围

如: 求6月份连续业绩大于100万的日期范围
第一:求日期相减值; 第二:分组求范围

/*6月份业绩超过100万的日期范围*/
WITH DayAchievement AS(
SELECT CONVERT(VARCHAR(10),bo.OrderDate,120) OrderDate,SUM(amount) OrderSum
FROM bdOrder bo(NOLOCK)
JOIN mdOrderStatus mos(NOLOCK) ON bo.OrderStatus = mos.StatusCode AND mos.IsAchievement = 1
WHERE bo.OrderDate >=’2011-06-01′
GROUP BY CONVERT(VARCHAR(10),bo.OrderDate,120)
)

SELECT MIN(OrderDate),MAX(OrderDate),
DATEDIFF(dd,MIN(OrderDate),MAX(OrderDate))+1,
SUM(OrderSum)
FROM (
SELECT a.OrderDate,a.OrderSum,DATEADD(dd,-1 * ROW_NUMBER() OVER ( ORDER BY a.OrderDate)+1,a.OrderDate) gy
FROM DayAchievement a
WHERE OrderSum >= 1000000
)m
GROUP BY gy

注:DATEADD(dd,-1 * ROW_NUMBER() OVER ( ORDER BY a.OrderDate)+1,a.OrderDate) gy 即是相减值(规律值)


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

1, 京东、淘宝这样的网上商城是综合性的,除按分类查询外,还要据属性进行进一步的筛选。它各种分类、各种产品都有,对应的产品属性是不一样的,将所有产品放到一张表中存储显然是不可取的,因为这样此表的栏位要多的不可想像,并且每种产品对应的属性栏位并不多,大部分栏位都浪费掉。
所以设计时:产品属性不能固化下来,而是要以行的形式存储。
对应结构为:
商品ID对应分类ID
分类ID对应属性组ID
商品属性ID对应商品ID、属性组ID、属性值
属性ID对应属性名称

2,而小一些的电子商城若只按分类查询,没有涉及属性的进一步的筛选,并且产品属于有限个种类,如保健药品类与健身器材类,因药类与器材类属性大部分相同,故分别开两张表即可:保健药品表、健身器材表。再加个产品与分类ID的关系表。

注:表设计的目的是将近相同属性的东西放到一块,有明显区别的需要拆分


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
中值:若总数为奇数,则中数为中间那个,若为偶数,则为中间两个平均 WITH RN AS(
SELECT CONVERT(VARCHAR(10),a.OrderDate,120) OrderDate,amount,
ROW_NUMBER () OVER ( PARTITION BY CONVERT(VARCHAR(10),a.OrderDate,120)  ORDER BY a.Amount,a.id) rx,
ROW_NUMBER () OVER ( PARTITION BY CONVERT(VARCHAR(10),a.OrderDate,120)  ORDER BY a.Amount DESC,a.id DESC  ) rl
FROM bdOrder a(NOLOCK)WHERE a.OrderDate >='2011-05-01' )
注:正序与倒序排,因为Amount值相同的情况,故要加id决定决胜因子。


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
可执行任意进制转换,2进制,8进制,32进制,36进制,进制数依赖于所能表示的字典数,如下'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' 36个字母,最大是36进制,下面关键一句是SET @alldigits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',用取字符串位置的方式得到结果。
IF OBJECT_ID('dbo.DecToBase') IS NOT NULLDROP FUNCTION dbo.DecToBase;GO
CREATE FUNCTION dbo.DecToBase(@val  BIGINT,@base  INT)RETURNS VARCHAR(63)ASBEGIN
    DECLARE @r AS VARCHAR(63),@alldigits AS VARCHAR(36)
    SET @alldigits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'    SET @r = ''
    WHILE @val > 0    BEGIN
        SET @r = SUBSTRING(@alldigits,@val%@base+1,1) + @r
        SET @val = @val / @base    END    RETURN @rENDgo


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

SELECT a.salesstaff,a.OrderNo,a.OrderDate,a.Amount,
SUM(amount) OVER (PARTITION BY a.SalesStaff)
FROM bdOrder a(NOLOCK)
WHERE a.OrderDate >=’2011-05-01′


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

SELECT CAST(CAST (100.* 1/CASE(2) WHEN 0 THEN 1 ELSE 2 END AS DECIMAL(5,2)) AS VARCHAR(50)) + ‘%’


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
WITH tmpArray AS  (    SELECT 'A' NAME , '20,233,2544,25567,14' array
    UNION ALL    SELECT 'B','30,-23433,28'    UNION ALL
    SELECT 'C','12,10,8099,12,1200,13,12,14,10,9'    UNION ALL
    SELECT 'D','-4,-6,-45678,-2')
SELECT a.name,SUBSTRING(a.array,n,CHARINDEX(',',a.array+',',n)-n)FROM tmpArray a
JOIN dbo.fn_nums(10000) fn ON FN.n <=LEN(a.array)  AND SUBSTRING(','+a.array,n,1) = ','
ORDER BY a.name注:CHARINDEX() 可以指定开始查询的位置


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

将ParentID结构形式的表转换成以OrganID为形式的表
?现有一地区表mdCity,结构为:
ID? ParentID Name
1??? 0??? 安徽省???????????????????????
2??? 1??? 安庆市???????????????????????
3??? 2??? 大观区???????????????????????
4??? 2??? 扬江区???????????????????????
5??? 2??? 宜秀区???????????????????????
6??? 1??? 蚌埠市?
7??? 0??? 福建省???????????????????????
8??? 7??? 福州市???????????????????????
9??? 8??? 仓山区???????????????????????
10??? 7??? 长乐市???????????????????????
11??? 7??? 福清市???????????????????????
12??? 11??? 鼓楼区??

需转换为:???
ID? OrganID Name
1??? 01??? 安徽省???????????????????????
2??? 0101??? 安庆市???????????????????????
3??? 010101??? 大观区???????????????????????
4??? 010102??? 扬江区???????????????????????
5??? 010103??? 宜秀区???????????????????????
6??? 0102??? 蚌埠市?
7??? 02??? 福建省???????????????????????
8??? 0201??? 福州市???????????????????????
9??? 020101??? 仓山区???????????????????????
10??? 0202??? 长乐市???????????????????????
11??? 0203??? 福清市???????????????????????
12??? 020301??? 鼓楼区??

构造以下Sql语句即可:
WITH wmdCity AS (
??? SELECT a.id,a.ParentID,a.Name, convert(varchar(50),RIGHT(‘0’ + convert(varchar(2),ROW_NUMBER () OVER ( ORDER BY? a.ID)),2)) organid
??? FROM mdCity a(NOLOCK)
??? WHERE a.ParentID = 0
??? UNION ALL
??? SELECT a.id,a.ParentID,a.Name,? convert(varchar(50),mc.organid + RIGHT(‘0’ + convert(varchar(2),ROW_NUMBER () OVER ( ORDER BY a.ID)),2))? organid
??? FROM mdCity a(NOLOCK)
??? JOIN wmdCity mc ON a.ParentID = mc.id
)
SELECT * from wmdcity mc
ORDER BY mc.organid


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

–数据库日志文件增长的很快,每次手工收缩不能及时,用下面的方法建立一job可以定时运行

USE brm_lvjian

–设置数据库恢复模式为简单
ALTER DATABASE BRM_LVJIAN
SET RECOVERY SIMPLE

–收缩日志到1M
DBCC SHRINKFILE (‘BRM_LVJIAN_Log’, 1);

–设置数据库恢复模式为完整
ALTER DATABASE BRM_LVJIAN
SET RECOVERY FULL


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

WITH orderdata AS(
SELECT bo.OrderNo,bo.OrderDate,bo.Amount,
NTILE(10) OVER (ORDER BY bo.Amount) groupid
FROM bdOrder bo
WHERE bo.OrderDate >=’2011-05-24′ AND bo.OrderDate < '2011-05-25' ) --分为10个组,每组上限与下限,及个数 SELECT a.groupid,MIN(amount),MAX(amount),COUNT(1) FROM orderdata a GROUP BY a.groupid 注:当组数无法整除行数时,前面的r个组比其它组多一行。如有11行,分3个组,那么前两个组分别有4个,后一个组有1个。