随笔分类 -  SQL点滴

SQL点滴
SQL Server的索引建议
摘要: 阅读全文

posted @ 2021-09-09 14:35 Neo0820 阅读(58) 评论(0) 推荐(0)

K/3 Cloud 单据关联查询
摘要:销售出库单 下推 销售退货单,如何获知他们的关联关系?T_SAL_OUTSTOCKENTRY 是销售出库单分录T_SAL_RETURNSTOCKENTRY 是销售退货单分录T_SAL_RETURNSTOCKENTRY_LK 是销售退货单单据关联配置表(关系表) FSBILLID是源单ID,FSID是 阅读全文

posted @ 2019-11-29 18:12 Neo0820 阅读(582) 评论(0) 推荐(0)

LAG函数实现环比
摘要:如图: 当然还有更直观的写法 其实会发现下面的写法和这里的写法获取的结果一样 一个是ORDER BY 年月 一个是ORDER BY 年,但是结果都是一样的。 参考: https://blog.csdn.net/mango_love/article/details/84067911 SQL SERVE 阅读全文

posted @ 2019-11-04 18:33 Neo0820 阅读(896) 评论(0) 推荐(0)

SQL Full Join 的 Where条件
摘要:SQL需求是损益视图串资产负债视图 用Excel透视表模拟出来的结果就是 用SQL查询如下: 当Where条件是左边的视图的时候 当Where条件是右边视图的时候 所以要慎重选择Where条件,同时如果这个数据集被CBoard调用的时候,那还要注意这些 项目了,因为Cboard会包一层视图,这时候项 阅读全文

posted @ 2019-03-22 12:26 Neo0820 阅读(1511) 评论(0) 推荐(0)

如何使用SQL Server事件探查器 跟踪 触发器
摘要:创建跟踪时选择“显示所有事件”然后选择 storage procedure -> SP:Starting 和 SP:StmtStarting 事件。启动跟踪即可。 阅读全文

posted @ 2012-03-07 15:51 Neo0820 阅读(5262) 评论(0) 推荐(0)

一句判断字符串里面包含多少个你想要查找字符&&实现LastIndexOf的SQL
摘要:需求:想要查找文本'00232.021.0334.035'里面包含多少个“.”实现方式通过SQL变通实现如下:selectlen('00232.021.0334.035')-len(replace('00232.021.0334.035','.',''))实现LastIndexOfselectlen('00232.021.0334.035')-CHARINDEX('.',REVERSE('00232.021.0334.035'))+1 阅读全文

posted @ 2011-12-08 14:15 Neo0820 阅读(350) 评论(0) 推荐(0)

EXCEPT 和 INTERSECT快速比较SQL表异同
摘要:比较两个查询的结果,返回非重复值。EXCEPT 从左查询中返回右查询没有找到的所有非重复值。INTERSECT 返回 INTERSECT 操作数左右两边的两个查询都返回的所有非重复值。以下是将使用 EXCEPT 或 INTERSECT 的两个查询的结果集组合起来的基本规则: 所有查询中的列数和列的顺序必须相同。 数据类型必须兼容。 法如果 EXCEPT 或 INTERSECT 操作数左边和右边的查询返回的可比较列的数据类型是具有不同排序规则的字符数据类型,则根据排序规则优先级的规则执行所需的比较。如果无法执行此转换,Microsoft SQL Server 2005 Database Engi 阅读全文

posted @ 2010-12-27 11:26 Neo0820 阅读(494) 评论(0) 推荐(0)

Northwind数据库惹的祸
摘要:早上使用Northwind数据库做Struts2和Hibernate的测试数据库,使用Struts的Action输出Categories数据表的Picture字段的数据,也就是输出图片。publicStringexecute(){***.redev.business.CategoriesbizCate=new***.redev.business.Categories();***.redev.orm... 阅读全文

posted @ 2008-05-22 16:54 Neo0820 阅读(380) 评论(0) 推荐(0)

查看SQL 版本
摘要:select serverproperty('productversion'),serverproperty('productlevel'),serverproperty('edition')SQL Server 2000 原始版本/8.00.194/RTM Database Components SP1/ 8.00.384/SP1 Database Components SP2/8.00.534... 阅读全文

posted @ 2008-04-21 14:49 Neo0820 阅读(574) 评论(0) 推荐(0)

SQL 中Having 的备忘
摘要:找到某个字段有重复的. select 字段,count(*) from hm_employees group by 字段having count(*)>1 阅读全文

posted @ 2008-03-05 11:32 Neo0820 阅读(213) 评论(0) 推荐(0)

SQL中的sysobjects与syscolumns
摘要:查看所有表名: select name from sysobjects where type='U' 查询表的所有字段名: Select name from syscolumns Where ID=OBJECT_ID('表名') select * from information_schema.tables select * from information_schema.vi... 阅读全文

posted @ 2008-02-25 14:10 Neo0820 阅读(2044) 评论(0) 推荐(0)

System stored procedures
摘要:System stored procedures This document contains information on undocumented stored procedures in Microsoft SQL Server. Name Function sp_cursor Update a cursor sp_cursorclose close a cursor sp_cursorexecute Open a prepared cursor sp_cursorfetch Fetch rows sp_cursoropen Open a cursor sp_cursoroption Set cursor options sp_cursorprepare Prepare a cursor statement sp_cursorprepexec Prepare a cursor statement and open sp_cur 阅读全文

posted @ 2008-02-21 14:43 Neo0820 阅读(866) 评论(0) 推荐(0)

导入导出Excel点滴
摘要:#region 输出Excel protected void ExcelOutput(System.Web.UI.WebControls.DataGrid dg,System.Data.DataTable dt) { Response.Clear(); Response.Buffer= tr... 阅读全文

posted @ 2007-07-26 09:51 Neo0820 阅读(510) 评论(0) 推荐(0)

游标
摘要:游标备忘 阅读全文

posted @ 2007-06-15 08:39 Neo0820 阅读(215) 评论(0) 推荐(0)

在sql中快速导入、导出Excel
摘要:--导出不能回行 EXEC master..xp_cmdshell 'bcp "exec dbo.Redev_pr_GetDepartment_LingShouZhan_ZuoYe" queryout "C:\LingShouZhan.xls" -Sfileserver -Usa -P123456 -c' --导入不能回行 SELECT * FROM OpenDataSource( '... 阅读全文

posted @ 2007-06-15 08:37 Neo0820 阅读(414) 评论(0) 推荐(0)

导航