摘要: Question: How can I list non-contignous data? In database pubs, I create a table test using statement as below, and I insert several row as below 程序代码 create table test ( id int primary key ) go inse... 阅读全文
posted @ 2008-10-13 17:25 chenjunbiao 阅读(336) 评论(0) 推荐(0) 编辑
摘要: Question: How can I add row numbers to my result set? In database pubs, have a table titles , now I want the result shown as below,each row have a row number, how can you do that? Result: line-no tit... 阅读全文
posted @ 2008-10-13 16:45 chenjunbiao 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Question: The Fastest Way to Recompile All Stored Procedures I have a problem with a database running in SQL Server 6.5 (Service Pack 4). We moved the database (object transfer) from one machine to ... 阅读全文
posted @ 2008-10-13 16:36 chenjunbiao 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Question:Can you create a cross-tab report in my SQL Server! How can I get the report about sale quality for each store and each quarter and the total sale quality for each quarter at year 1993? You... 阅读全文
posted @ 2008-10-13 13:52 chenjunbiao 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Question:Can you use a SQL statement to finding duplicate values! How can I find authors with the same last name? You can use the table authors in datatabase pubs. I want to get the result as below: O... 阅读全文
posted @ 2008-10-13 13:39 chenjunbiao 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Question:Can you use a SQL statement to calculating it! How can I print "10 to 20" for books that sell for between $10 and $20,"unknown" for books whose price is null, and "other" for all other prices... 阅读全文
posted @ 2008-10-13 13:00 chenjunbiao 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Q:Can you use a batch SQL or store procedure to calculating the Number of Days in a Month? A: 解法一:使用CTE,结构清晰 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighli... 阅读全文
posted @ 2008-10-13 10:21 chenjunbiao 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Q:删除某字段中的重复记录,Table1006表中有Id和Phone字段,Id为不重复的标字段,但是Phone含有重复字段,现在需要重复Phone记录行删除掉,只保留最新一条记录。 A: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> ... 阅读全文
posted @ 2008-10-13 09:57 chenjunbiao 阅读(160) 评论(0) 推荐(0) 编辑