摘要:---使用 UNION、INTERSECT 或 EXCEPT 运算符合并的所有查询必须在其目标列表中有相同数目的表达式select * from BookInfoList--存在不同的select BookInfoID,BookInfoBarCode from BookInfoList where ...
阅读全文
posted @ 2014-06-12 11:28
®Geovin Du Dream Park™
阅读(493)评论(0)推荐(0)
摘要:--显示所有用户表:--1SELECT SCHEMA_NAME(schema_id) As SchemaName , name As TableName from sys.tables ORDER BY name--2。alternate:SELECT sch.name As Schem...
阅读全文
posted @ 2014-05-15 22:59
®Geovin Du Dream Park™
阅读(1160)评论(0)推荐(0)
摘要:---Example Uses of the SUBSTRING String Function--http://www.sql-server-helper.com/tips/tip-of-the-day.aspx?tkey=4AB06421-E859-4B5F-A948-0C9640F3108D&tkw=sample-uses-of-the-substring-string-function--取名字Usage #1 : Get the First Name and Last Name from a Full NameDECLARE @FullName VARCHAR(50) --s
阅读全文
posted @ 2014-01-21 12:09
®Geovin Du Dream Park™
阅读(404)评论(0)推荐(0)
摘要:http://www.wiseowl.co.uk/blog/s334/calendar.htmSQL Server 2012 1 CREATE PROC spCreateCalendarTable( 2 @StartDate datetime = '20000101', 3 @EndDate datetime = '20201231' 4 ) AS 5 6 -- create a table of dates for use in PowerPivot 7 8 -- NOT FOR COMMERCIAL USE OR REDISTRIBUTION 9 -- WI
阅读全文
posted @ 2013-03-06 10:32
®Geovin Du Dream Park™
阅读(420)评论(0)推荐(0)
摘要:---表中的主鍵select [name],'tablekey'= (select top 1 COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where TABLE_NAME = sysobjects.name) from sysobjects where type='U'--所有表select * from sysobjects where type='U'--所有表的主鍵 COLUMN_NAMEselect * from INFORMATION_SCHEMA.KEY_COLUMN_U
阅读全文
posted @ 2012-12-27 19:18
®Geovin Du Dream Park™
阅读(477)评论(0)推荐(0)
摘要:---沒有去除重復的記錄select distinct ContractLaborEmployeeUidKey,ContractLaborEndDate from ContractLaborList order by ContractLaborEndDate descselect * from ContractLaborList order by ContractLaborEmployeeUidKey---沒有去除重復的記錄select * from ContractLaborList where ContractLaborEmployeeUidKey in (select distinct.
阅读全文
posted @ 2012-10-31 19:18
®Geovin Du Dream Park™
阅读(246)评论(0)推荐(0)