¹¤×÷ÖлýÔܵļ¸¸ö×Ô¶¨ÒåSQLº¯Êý
¹¤×÷ÖлýÔܵļ¸¸ö×Ô¶¨ÒåSQLº¯Êý:
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: ×Ö·û´®ÇиÊý
-- =============================================
ALTER function [dbo].[Split]
(
@Text nvarchar(4000),
@Sign nvarchar(4000)
)
returns @tempTable table(id int identity(1,1) primary key,[value] nvarchar(4000))
AS
begin
declare @StartIndex int --¿ªÊ¼²éÕÒµÄλÖÃ
declare @FindIndex int --ÕÒµ½µÄλÖÃ
declare @Content varchar(4000) --ÕÒµ½µÄÖµ
set @StartIndex = 1
set @FindIndex=0
--±éÀúÿ¸ö×Ö·û
while(@StartIndex <= len(@Text))
begin
SELECT @FindIndex = charindex(@Sign,@Text,@StartIndex)
--ÅжÏÓÐûÕÒµ½ ûÕÒµ½·µ»Ø0
IF(@FindIndex =0 OR @FindIndex IS NULL)
begin
set @FindIndex = len(@Text)+1
end
set @Content = ltrim(rtrim(substring(@Text,@StartIndex,@FindIndex-@StartIndex)))
set @StartIndex = @FindIndex+1
insert into @tempTable ([value]) values (@Content)
end
return
end
-- ==========
Ïà¹ØÎĵµ£º
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......
http://www.umgr.com/blog/PostView.aspx?bpId=36294
1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬ char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......
SQL Server .NET Framework Êý¾ÝÌṩ³ÌÐò (SqlClient) Ìṩ¾ÛºÏº¯Êý¡£¾ÛºÏº¯Êý¶ÔÒ»×éÊäÈëÖµÖ´ÐмÆËã²¢·µ»ØÒ»¸öÖµ¡£ÕâЩº¯ÊýλÓÚ SqlServer ÃüÃû¿Õ¼äÖУ¬¸ÃÃüÃû¿Õ¼äÔÚÄúʹÓà SqlClient ʱ¿ÉÓá£Ìṩ³ÌÐòµÄÃüÃû¿Õ¼äÊôÐÔʹʵÌå¿ò¼Ü¿ÉÒÔÈ·¶¨´ËÌṩ³ÌÐò¶ÔÌض¨¹¹Ô죨ÈçÀàÐͺͺ¯Êý£©Ê¹ÓÃÄĸöǰ׺¡£
ϱíÏÔʾ SqlClient ¾ÛºÏº¯Êý¡£ ......
ÒÔÏÂÊÇÎÒÔÚѧϰÖеĵãµÎ¼Ç¼£¬Èç¹ûÓдíÎóµÄµØ·½»òÕßȱÉÙ²¿·Ö£¬Çë¸÷λ´óÏÀ²»ÁßÖ¸½Ì¡£Ð¡µÜÔÚ´Ëл¹ýÁË
1.select count£¨*£© ºÍselect count£¨id£© Ö®¼äµÄÇø±ð¡£
select count(*) ͳ¼ÆËùÓмǼ¸öÊý£¬°üÀ¨¿Õ¼Ç¼¡£
Select count(Id) ͳ¼ÆËùÓмǼ¸öÊý£¬²»°üÀ¨null¼Ç¼¡£
2.delete & truncate µÄÇø±ð
trunc ......