類比多級表頭的分組統計

原帖地址:http://community.csdn.net/Expert/topic/3434/3434688.xml?temp=3.246486E-03--測試資料create table 單位表 (單位代碼 varchar(10),單位名稱 varchar(50))insert 單位表 values('01'      ,'中國單位')             --1級insert 單位表 values('0101'    ,'山東單位')             --2級insert

字串分拆查詢

原帖地址:http://community.csdn.net/Expert/topic/3230/3230422.xml?temp=.7884485有這樣的資料 欄位1      欄位2  2,4,23    3,6,345 23,56,4   3,3,67取資料的是查詢 欄位1中 條件是 4 那麼在欄位2  在取的是6與 67結果如下============4     64     67------------------------------------------------------

動態關聯表

原帖地址:http://community.csdn.net/Expert/topic/3452/3452577.xml?temp=.1377375--樣本資料create table [table](A sysname,B varchar(10))insert [table] select 'table_1','a'union  all     select 'table_2','b'create table table_1(A int)insert table_1 select

根據當月資料庫自動產生下個月資料庫–1

/*--原帖地址:http://community.csdn.net/Expert/topic/3818/3818559.xml?temp=.9593317--*//*--處理要求在sql資料庫裡有一個名為Pos200502的Database,每個月會有一個類似於這樣名稱(Pos200502 Pos200503)的database我該如何利用sql

根據產品損耗率計算產品實際數量

原帖地址:http://community.csdn.net/Expert/topic/3236/3236660.xml?temp=.9309046表T1(記錄的是產品加工步驟的損耗情況)Cp_No(產品編碼)   Cp_Step(加工步驟)         Cp_Shl(損耗率)001                    1                       0.1001                    2                       0.15001     

樹形資料轉換

原帖地址:http://community.csdn.net/Expert/topic/3663/3663934.xml?temp=.9100458--測試資料create table PROJECT(id int,name nvarchar(20),parent_id int)insert PROJECT select 1,'所有項目',nullunion  all     select 2,'項目1',1union  all     select 3,'項目2',1create table

根據當月資料庫自動產生下個月資料庫–2

--方法2. 指令碼複製use mastergoif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_ProcCopyDb]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure

欄位裡字串的處理問題

原帖地址:http://community.csdn.net/Expert/topic/3244/3244874.xml?temp=.5755274表一:MenuTree? Id??????????????????? context????????????????? -----------? ---------------------------1????????????????????? 商場監測系統? 3????????????????????? 綜合報表分析? 4?????????????

自訂公式的計算處理

原帖地址:http://community.csdn.net/Expert/topic/3485/3485588.xml?temp=.8813745--樣本資料create table sale(date datetime,code varchar(10),amt int)insert sale select '2004-10-22','aa',15000union  all  select '2004-10-22','bb',18000union  all  select '2004-10-2

估計表的大小(一)

估計表的大小下列步驟可用於估計儲存表中的資料所需的空間量。 指定表中的行數: 表中的行數 = Num_Rows如果在表的定義中有固定長度和可變長度列,請計算資料行中這兩組列的每一組所佔用的空間。列的大小取決於資料類型和長度說明。有關更多資訊,請參見資料類型。 列數 = Num_Cols所有固定長度列中的位元組總和 = Fixed_Data_Size可變長度列數 = Num_Variable_Cols所有可變長度列的最大值 =

特殊分頁處理

原帖地址:http://community.csdn.net/Expert/topic/3662/3662135.xml?temp=.4289972--測試資料create table tb(ID int primary key,grade varchar(10),uptime datetime)insert tb select 1 ,'a','2004-12-11'union all select 2 ,'b','2004-12-11'union all select 3 ,'c','2004

根據當月資料庫自動產生下個月資料庫–3

 --建立一個每月最後一個工作日執行的作業,調用上述預存程序實現自動建立資料庫use mastergo--設定 SQL Agent 服務為自動啟動exec msdb..sp_set_sqlagent_properties @auto_start=1go--建立作業exec msdb..sp_add_job @job_name=N'自動建庫處理'--建立作業步驟declare @sql varchar(800),@dbname varchar(250)select @sql=N'exec

索引對查詢條件順序的影響

原帖地址:http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=207897環境:Sql Server2000 +sp4問題:select datediff(day,'20040910','20040920')  --這句可以執行--而下面這句不能執行(有時也可以執行)--sub_para為varchar(8),錯誤資訊是:從字串轉換為 datetime 時發生語法錯誤。select * from T_SUB where

估計表大小(三)–估計無叢集索引的表的大小

估計無叢集索引的表的大小下列步驟可用於估計儲存沒有叢集索引的表上的資料和任何附加的非叢集索引所需的空間。 計算儲存資料所用的空間。 計算儲存每個附加非叢集索引所用的空間。 匯總計算所得的值。 對於每個計算,都要指定將在表中出現的行數。表中的行數將對錶的大小有直接影響:表中的行數 = Num_Rows計算儲存資料所用的空間若要計算儲存資料所用的空間,請參見估計表的大小。 記下計算所得的值:儲存資料所用的空間 =

逐月對比的交叉表處理

/*--原帖地址:http://community.csdn.net/Expert/topic/3841/3841808.xml?temp=.4308588--*/--測試資料create table tb(year int,month int,No varchar(10),Name varchar(10),部門 varchar(10),工資 int)insert tb select 2004,10,'A001','AAA','DDD',1000union all select 2004,10,

SQL BUG集之”隨機排序中的newid()問題”

/**==** 2. 隨機排序中的newid()問題 **==**/--測試資料declare @t table(name char(1),value int)insert into @tselect 'a',1union all select 'a',2union all select 'b',3union all select 'b',4union all select 'c',5union all select 'c',6--要求,隨機排序,但name相同的要排在一齊select

自動產生剩餘編號字串

原帖地址:http://community.csdn.net/Expert/topic/3220/3220744.xml?temp=.6029474問題描述:insert 主表 select 'Q',0000001,0000100,100,'0000001-0000100'? union all select 'M',0000001,0000200,200,'0000001-0000200'insert 子表 select 'Q',0000011,0000030,20union all

無規律自訂分段的分類匯總+交叉表處理

/*--原帖地址:http://community.csdn.net/Expert/topic/3845/3845290.xml?temp=.3689386--*/--測試資料create table tb(編號 int,性質 varchar(10),數量 int,指標1 decimal(10,1),指標2 decimal)insert tb select 1 ,'00' ,10,1.1 ,10union all select 2 ,'01' ,20,1.2 ,20union all

動態分組查詢

原帖地址:http://community.csdn.net/Expert/topic/3428/3428792.xml?temp=.6476251--樣本資料create table 表(ID int,NUM int)insert 表 select 1,2union all select 2,3union all select 3,2union all select 4,2union all select 5,12union all select 6,2union all select 7,1

先進先出的還款處理觸發器

有 兩個表:表1:借支姓名   日期   借支單號     借支金額     已還金額     未還餘額張三  99-1-1  000001      10000          0           10000李四  99-1-2  000002      5000           0           5000張三  99-2-1  000003      6000           0           6000張三  99-3-1  000004      10000   

總頁數: 61357 1 .... 20185 20186 20187 20188 20189 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.