根據排序定義表排序資料 測試資料: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
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[f_split]') and xtype in (N'FN', N'IF', N'TF'))drop function [dbo].[f_split]GO/*--得到字串列表指定位置的字元 可以自訂字串列表的分隔字元 如果取數位置超出的範圍,返回Null 字元串--鄒建
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