根據排序定義表排序資料 測試資料:create table tb1(id int,col1 varchar(10),col2 int)insert tb1 select 1,'aa',111union all select 2,'aa',111union all select 3,'aa',111union all select 4,'bb',222union all select 5,'bb',222union all select 6,'cc',333union all
/**==** 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
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_movefile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[p_movefile]GO/*--行動服務器上的檔案 不藉助 xp_cmdshell ,因為這個在大多數時候都被禁用了--鄒建 2004.08(引用請保留此資訊)--*//*--調用樣本 exec p_
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_binaryIO]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[p_binaryIO]GO/*--bcp
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_movefile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[p_movefile]GO/*--在文字檔中追加資料 在文字檔中追加資料 如果檔案不存在,將建立檔案--鄒建 2004.08(引用請保留此資訊)--*//*--調用樣本 exec p_movefile
在sql2000和7.0的查詢語句中,區分大寫的查詢方法--sql2000,就用下面的方法.--就是在欄位名後加 collate Chinese_PRC_CS_AS_WS --區分大小寫、全半形字元的方法--測試資料create table 表(fd varchar(10))insert into 表select aa='aa'union all select 'Aa'union all select 'AA' --全形Aunion all select
從dBase檔案中,匯入資料到SQL資料庫中,很簡單,直接用下面的語句:/*===================================================================*/--如果接受資料匯入的表已經存在insert into 表 select * from openrowset('MICROSOFT.JET.OLEDB.4.0','dBase 5.0;DATABASE=c:/','select * from