Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
原帖地址: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------------------------------------------------------
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
/*--原帖地址:http://community.csdn.net/Expert/topic/3818/3818559.xml?temp=.9593317--*//*--處理要求在sql資料庫裡有一個名為Pos200502的Database,每個月會有一個類似於這樣名稱(Pos200502 Pos200503)的database我該如何利用sql
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
--方法2. 指令碼複製use mastergoif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_ProcCopyDb]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure
Time of Update: 2018-12-03
原帖地址:http://community.csdn.net/Expert/topic/3244/3244874.xml?temp=.5755274表一:MenuTree? Id??????????????????? context????????????????? -----------? ---------------------------1????????????????????? 商場監測系統? 3????????????????????? 綜合報表分析? 4?????????????
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
估計表的大小下列步驟可用於估計儲存表中的資料所需的空間量。 指定表中的行數: 表中的行數 = Num_Rows如果在表的定義中有固定長度和可變長度列,請計算資料行中這兩組列的每一組所佔用的空間。列的大小取決於資料類型和長度說明。有關更多資訊,請參見資料類型。 列數 = Num_Cols所有固定長度列中的位元組總和 = Fixed_Data_Size可變長度列數 = Num_Variable_Cols所有可變長度列的最大值 =
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
--建立一個每月最後一個工作日執行的作業,調用上述預存程序實現自動建立資料庫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
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
估計無叢集索引的表的大小下列步驟可用於估計儲存沒有叢集索引的表上的資料和任何附加的非叢集索引所需的空間。 計算儲存資料所用的空間。 計算儲存每個附加非叢集索引所用的空間。 匯總計算所得的值。 對於每個計算,都要指定將在表中出現的行數。表中的行數將對錶的大小有直接影響:表中的行數 = Num_Rows計算儲存資料所用的空間若要計算儲存資料所用的空間,請參見估計表的大小。 記下計算所得的值:儲存資料所用的空間 =
Time of Update: 2018-12-03
/*--原帖地址: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,
Time of Update: 2018-12-03
/**==** 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
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
/*--原帖地址: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
Time of Update: 2018-12-03
原帖地址: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
Time of Update: 2018-12-03
有 兩個表:表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