2012年1月11日

摘要: Sql server 2012 加入了一些新的系统函数, 下边简单介绍一下CONCATCONCAT 函数最多可以连接255个字符变量,当调用这个函数的时候需要至少接收两个参数,参数类型不一定是字符串类型,也可以是可以隐式转换为字符串的类型比如int ,float等类型。只要符合sql 2012的能隐式转换为字符串的规则即可,当我们想把两个值类型的数据连接起来的时候,不需要先将它们转为nvarchar然后再通过“+”来连接了如果传入的参数为null,则会把它隐式转换为空字符串,如果所有的输入参数 都是null的话, 会返回一个类型为 VARCHAR(1)的空字符串。语法规则SELECT CONC 阅读全文

posted @ 2012-01-11 12:29 nealgaga 阅读(2483) 评论(7) 推荐(3)


2012年1月9日

摘要: Datetime Types in SQL Server 2005:Lets start with a quick look at the existing date time types in SQL Server. The datetime and smalldatetime, these two types are well known to us, So we wont be spending much time here.Data TypeRepresentationAccuracysmalldatetimeYYYY-MM-DD hh:mm:ss1 minutedatetimeYYY 阅读全文

posted @ 2012-01-09 11:36 nealgaga 阅读(977) 评论(0) 推荐(0)


2011年11月9日

摘要: 现在许多公司做报表 通常使用Fiscal Date,但是通常我们收集到的数据是Calendar Date,所以他们之间必然需要一种转换。以下仅适用于财年不变的情况,欢迎指正和改进Fiscal Year,Fiscal Month的转换比较简单,比如公司一个财年的startDate 为 July 01, endDate 为June 30.那么只要判断月份是否大于6即可确定Fiacal Year和Fiscal MonthDECLARE @testDate DATETIME; SET @testDate=GETDATE(); SELECT CASE WHEN MONTH(@testDate)... 阅读全文

posted @ 2011-11-09 17:58 nealgaga 阅读(3517) 评论(2) 推荐(0)


2011年11月1日

摘要: CREATE FUNCTION dbo.ipStringToBigInt ( @ip CHAR(15) ) RETURNS bigint AS BEGIN DECLARE @rv bigint, @o1 bigint, @o2 INT, @o3 INT, @o4 INT SELECT @o1 = CONVERT(INT, PARSENAME(@ip, 4)), ... 阅读全文

posted @ 2011-11-01 11:27 nealgaga 阅读(246) 评论(0) 推荐(0)


2011年6月23日

摘要: Table A have three columns, for each ID group, there are one or two or three codes (three is max), and for each code, there is a specific value associated with it, please write a sql to get the data in table B, where Code1 is the Code whose values is the smallest, value1 is the value of code1,the va 阅读全文

posted @ 2011-06-23 14:16 nealgaga 阅读(357) 评论(0) 推荐(2)

摘要: 今天遇到一个题目:You are a database developer on an instance of SQL Server. You have a table named Category. The Category table contains a hierarchy of living things to the sub-species level. Each row in the Category table has a ParentCatlD value that corresponds to the item’s parent classification in the h 阅读全文

posted @ 2011-06-23 14:02 nealgaga 阅读(1142) 评论(1) 推荐(2)


2011年5月30日

摘要: I often hear the question, “Should I design a base type or an interface?” The answer isn’talways clear-cut. Here are some guidelines that might help you:n IS-A vs. CAN-DO relationship A type can inherit only one implementation. If thederived type can’t claim an IS-A relationship with the base type, 阅读全文

posted @ 2011-05-30 14:20 nealgaga 阅读(258) 评论(0) 推荐(0)


2011年5月24日

摘要: 个常见的例子,在使用for语句结构时,可能会有这样的代码:CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->int[]array={1,2,3,4,5};for(inti=0;i<array.Length;i++){Console.WriteLine(array[i]);}或者CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www 阅读全文

posted @ 2011-05-24 10:53 nealgaga 阅读(447) 评论(0) 推荐(0)


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3