SQLʵÏÖÍêÈ«ÅÅÁÐ×éºÏ
---SQLʵÏÖÍêÈ«ÅÅÁÐ×éºÏ
create function F_strSpit(@s varchar(200)) returns table
as
return(
select value=substring(@s,i,num)+substring(@s,num-1+j,1)
from (select num=number from spt_values where type='p' and number<len(@s) and number>0)TA,
(select i=number+1 from spt_values where type='p' and number<len(@s)-1)TB,
(select j=number+2 from spt_values where type='p' and number<len(@s)-1)TC
where num-1+j<=len(@s) and j>i )
declare @s varchar(200)
set @s='ABCE'
select * from dbo.F_strSpit(@s) order by len(value),value
/*
value
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AB
AC
AE
BC
BE
CE
ABC
ABE
BCE
ABCE
£¨ËùÓ°ÏìµÄÐÐÊýΪ 10 ÐУ©
*/
drop function F_strSpit
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Çå¿ÕÈÕÖ¾£º
dump transaction ¿âÃû with no_log
½Ø¶ÏÈÕÖ¾£º
backup log ¿âÃû with no_log
ѹËõÊý¾Ý¿â£º
dbcc shrinkdatabase (¿âÃû, Ä¿±ê±ÈÂÊ)
ѹËõÊý¾Ý¿âÎļþ£º
dbcc shrinkfile (ÎļþÃû»òID, Ä¿±ê´óС)
ÎļþÃû»òID¿ÉÒÔͨ¹ýϵͳ±ísysfiles²éÕÒ£¬Èç¹û²»Ö¸¶¨Ä¿±ê´óСSQL Server½«×î´óÏ޶ȵÄѹËõÊý¾Ý¿âÎļþ¡£
²é¿´Ñ¹ ......
SQL Server×Ö·û´®´¦Àíº¯Êý´óÈ«
selectÓï¾äÖÐÖ»ÄÜʹÓÃsqlº¯Êý¶Ô×ֶνøÐвÙ×÷£¨Á´½Ósql server£©£¬
select ×Ö¶Î1 from ±í1 where ×Ö¶Î1.IndexOf("ÔÆ")=1;
ÕâÌõÓï¾ä²»¶ÔµÄÔÒòÊÇindexof£¨£©º¯Êý²»ÊÇsqlº¯Êý£¬¸Ä³Ésql¶ÔÓ¦µÄº¯Êý¾Í¿ÉÒÔÁË¡£
left£¨£©ÊÇsqlº¯Êý¡£
select ×Ö¶Î1 from ±í1 where charindex£¨'Ô ......
SQL£¨½á¹¹»¯²éѯÓïÑÔ£©×¢È룬¼òµ¥À´Ëµ¾ÍÊÇÀûÓÃSQLÓï¾äÔÚÍⲿ¶ÔSQLÊý¾Ý¿â½øÐвéѯ£¬¸üеȶ¯×÷¡£Ê×ÏÈ£¬Êý¾Ý¿â×÷Ϊһ¸öÍøÕ¾×îÖØÒªµÄ×é¼þÖ®Ò»£¨Èç¹ûÕâ¸öÍøÕ¾ÓÐÊý¾Ý¿âµÄ»°£©£¬ÀïÃæÊÇ´¢´æן÷ÖÖ¸÷ÑùµÄÄÚÈÝ£¬°üÀ¨¹ÜÀíÔ±µÄÕ˺ÅÃÜÂë ......
¡¡¡¡Ïò±íÖÐÔö¼ÓÒ»¸ö varchar ÁУº
¡¡¡¡ALTER TABLE distributors ADD COLUMN address varchar(30);
¡¡¡¡´Ó±íÖÐɾ³ýÒ»¸ö×ֶΣº
¡¡¡¡ALTER TABLE distributors DROP COLUMN address RESTRICT;
¡¡¡¡ÔÚÒ»¸ö²Ù×÷ÖÐÐÞ¸ÄÁ½¸öÏÖÓÐ×ֶεÄÀàÐÍ£º
¡¡¡¡ALTER TABLE distributors
¡¡¡¡ALTER COLUMN address TYPE varchar(80),
......