SQL Server TEXTÀàÐÍ×Ö¶Î×Ö·û´®Ì滻ʾÀý´¦Àí½Å±¾
/*--text×ֶεÄÌæ»»´¦Àí
--*/
--´´½¨Êý¾Ý²âÊÔ»·¾³
--create table #tb(aa text)
declare @s_str varchar(8000),@d_str varchar(8000), --¶¨ÒåÌæ»»µÄ×Ö·û´®
@p varbinary(16),@postion int,@rplen int,@i_Start int, @i_End int
select identity(int,1,1) as [id],newsid into # from news
select @i_Start=min([id]),@i_End=max([id]) from #
while (@i_Start<=@i_End)
begin
--insert into #tb(aa) select content from # where [id]=@i_Start
select @s_str='\' --ÒªÌæ»»µÄ×Ö·û´®
,@d_str='!' --Ìæ»»³ÉµÄ×Ö·û´®
--×Ö·û´®Ìæ»»´¦Àí
select @p=textptr(content),@rplen=len(@s_str),@postion=charindex(@s_str,content)-1 from news where newsid in (select top 1 newsid from # where [id]=@i_Start)
while @postion>0
begin
updatetext news.content @p @postion @rplen @d_str
select @postion=charindex(@s_str,content)-1 from news where newsid in (select top 1 newsid from # where [id]=@i_Start)
end
--truncate table #tb
select @i_Start=@i_Start+1
end
--ɾ³ýÊý¾Ý²âÊÔ»·¾³
--drop table #tb
drop table #
Ïà¹ØÎĵµ£º
´æ´¢½ø³Ì¾ÍÊÇ×÷Ϊ¿ÉÖ´ÐжÔÏó´æ·ÅÔÚÊý¾Ý¿âÖеÄÒ»¸ö»ò¶à¸öSQLÃüÁî¡£
¶¨Òå×ÜÊǺܳéÏó¡£´æ´¢½ø³ÌÆäʵ¾ÍÊÇÄÜÍê³ÉÒ»¶¨²Ù×÷µÄÒ»×éSQLÓï¾ä£¬Ö»²»¹ýÕâ×éÓï¾äÊÇ·ÅÔÚÊý¾Ý¿âÖеÄ(ÕâÀïÎÒÃÇ̸ֻSQL SERVER)¡£Èç¹ûÎÒÃÇͨ¹ý´´½¨´æ´¢½ø³ÌÒÔ¼°ÔÚASPÖе÷Óô洢½ø³Ì£¬¾Í¿ÉÒÔ±ÜÃ⽫SQLÓï¾äͬASP´úÂë»ìÔÓÔÚÒ ......
µÚÒ»Ì⣺
Ϊ¹ÜÀíÒµÎñÅàѵÐÅÏ¢£¬½¨Á¢3¸ö±í£º
S(S#,SN,SD,SA)S#,SN,SD,SA·Ö±ð´ú±íѧºÅ£¬Ñ§Ô±ÐÕÃû£¬ËùÊôµ¥Î»£¬Ñ§Ô±ÄêÁä
C(C#,CN)C#,CN·Ö±ð´ú±í¿Î³Ì±àºÅ£¬¿Î³ÌÃû³Æ
SC(S#,C#,G) S#,C#,G·Ö±ð´ú±íѧºÅ£¬ËùÑ¡µÄ¿Î³Ì±àºÅ£¬Ñ§Ï°³É¼¨
(1)ʹÓñê×¼SQLǶÌ×Óï¾ä²éѯѡÐ޿γÌÃû³ÆΪ’Ë°ÊÕ»ù´¡’µÄѧԱѧºÅºÍÐÕÃû?
(2) ʹ ......
1.´ò¿ªSQL Server Management Studio ExpressÒÔ“WindowsÉí·ÝÈÏÖ¤”µÄ·½Ê½µÇ¼¡£Èçͼ1£º
ͼ1£º
2.ÔÚSQL Server Management Studio ExpressÖеē¶ÔÏó×ÊÔ´¹ÜÀíÆ÷”--“Êý¾Ý¿â”ÉÏÓÒ¼ü--“¸½¼Ó”¡£Èçͼ2£º
ͼ2£º
3.ÔÚµ¯³öÀ´µÄ“¸½¼ÓÊý¾Ý¿â”´°¿ÚÖе¥» ......
.NETÖÐC#µÄbyte¹Ø¼ü×ÖÓ³Éä.NETµÄByte½á¹¹£º±íʾһ¸ö 8 λÎÞ·ûºÅÕûÊý¡£Byte ÖµÀàÐͱíʾֵ½éÓÚ 0 ºÍ 255 Ö®¼äµÄÎÞ·ûºÅÕûÊý¡£
.NETÖÐC#µÄshort¹Ø¼ü×ÖÓ³Éä.NETÖеÄInt16£ºÓзûºÅ 16 λÕûÊý£¬-32,768 µ½ 32,767¡£
SQL SERVERÖеÄtinyint:´Ó 0 µ½ 255 µÄÕûÐÍÊý¾Ý¡£´æ´¢´óСΪ 1 ×Ö½Ú¡£
sbyte£º´æ´¢8λ´ø·ûºÅÕûÊý¡£sbyt ......
·½·¨Ò»£º
select distinct name from tablename
·½·¨¶þ£º
select min(fid),name,sex from tablename group by name
×ܼƣº
select distinct name from tablename ´ò¿ªÖظ´¼Ç¼µÄµ¥¸ö×Ö¶Î
select * from tablename where fid in(Select min(fid) from tablename group by name)´ò¿ªÖظ´¼Ç¼µÄËùÓÐ×Ö¶ÎÖµ
select ......