Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLServer 2005 ³£Óõĺ¯Êý

×Ö·û´®º¯Êý£º
¡ñ¡¡ASCII('a')=97---·µ»Ø×Öĸa¶ÔÓ¦µÄASCIIÂë
¡ñ¡¡CHAR('48')=0---·µ»Ø48Õâ¸öASCIIÂë¶ÔÓ¦µÄ×Ö·û
¡ñ¡¡LCASE('ABcdE')="abced" »ò LOWER('ABcdE')="abced"£¨½«¸ø¶¨×Ö·û´®×ªÎªÐ¡Ð´£©
¡ñ¡¡UCASE('ABcdE')="ABCDE" »ò UPPER('ABcdE')="ABCDE"£¨½«¸ø¶¨×Ö·û´®×ªÎª´óд£©
¡ñ¡¡LTRIM('  fgf gh  ')="fgf gh  "£¨È¥µô¸ø¶¨×Ö·û´®×ó±ßµÄ¿Õ¸ñ£©
¡ñ¡¡RTRIM('  fgf gh  ')="  fgf gh"£¨È¥µô¸ø¶¨×Ö·û´®ÓұߵĿոñ£©
¡ñ¡¡LEN('sde123-TRE')=10£¨·µ»Ø¸ø¶¨×Ö·û´®µÄ³¤¶È£©
¡ñ¡¡LEFT('sde123-TRE',5)="sde12"£¨´Ó¸ø¶¨×Ö·û´®×ó±ß¿ªÊ¼£¬È¡Ö¸¶¨³¤¶ÈµÄ×Ö·û£©
¡ñ¡¡RIGHT('sde123-TRE',4)="-TRE"£¨´Ó¸ø¶¨×Ö·û´®Óұ߿ªÊ¼£¬È¡Ö¸¶¨³¤¶ÈµÄ×Ö·û£©
¡ñ¡¡SUBSTRING('sde123-TRE',3,6)="e123-T"£¨´Ó¸ø¶¨×Ö·û´®µÄÖ¸¶¨Î»ÖÿªÊ¼£¬È¡Ö¸¶¨³¤¶ÈµÄ×Ö·û£©
¡ñ¡¡CHARINDEX('23-','sde123-TRE')=5£¨·µ»ØµÚÒ»¸ö×Ö·û´®ÔÚµÚ¶þ¸ö×Ö·û´®ÖгöÏÖµÄÊ×λÖã¬Èç¹ûδ³öÏÖÔò·µ»Ø0£©
      £¨×¢Ò⣺CHARINDEX('23T','sde123-TRE')=0£©        
      £¨×¢Ò⣺CHARINDEX('TRE','DFTRE345TREDGS')=3¶øCHARINDEX('TRE','DFTRE345TREDGS',4)=9£¬ÒòΪµÚÈý¸ö²ÎÊýδдÔò²éÕÒ´ÓµÚÒ»¸ö×Ö·û¿ªÊ¼£»·ñÔò´ÓµÚÈý¸ö²ÎÊýÖ¸¶¨µÄλÖÿªÊ¼²éÕÒ£»µÚ¶þ¸öÀý×ÓÊÇ´ÓµÚ4λ¿ªÊ¼²éÕÒ£¬ÕÒµ½µÄµÚÒ»¸ö"TRE"λÓÚµÚ9룩
¡ñ¡¡REVERSE('SDF463')="364FDS"£¨½«¸ø¶¨×Ö·û´®·´×ª£©
¡ñ¡¡REPLACE('abcdefghicde','cde','xx')="abxxfghixx"£¨ÓõÚÈý¸ö×Ö·û´®Ìæ»»µÚÒ»¸ö×Ö·û´®ÖеÄËùÓеڶþ¸ö×Ö·û´®£©
¡ñ¡¡STR(123.457,5,2)="123.46"£¨½«Êý×ÖתΪ×Ö·û´®£¬µÚÒ»¸ö²ÎÊýÊÇҪת»»µÄÊý×Ö£¬µÚ¶þ¸ö²ÎÊýÊÇת»»ºóµÄ×Ö·û´®µÄ×î´ó³¤¶È£¬µÚÈý¸ö²ÎÊýÖ¸¶¨±£Áô¼¸Î»Ð¡Êý£¬Çë×¢Ò⣬ÕâÖÖת»»ÊÇËÄÉáÎåÈëµÄ£©
      £¨×¢Ò⣺STR(123.457,2,2)="**"------ÒòΪ5СÓÚ123.457µÄ³¤¶È£©
¡ñ¡¡STUFF('I AM NIMMY,WEI COME!',6,5,'RWM')="I AM RWM,WEI COME!"£¨½«¸ø¶¨×Ö·û´®ÖеÄijһ²¿·Öɾ³ý²¢²åÈëÖ¸¶¨µÄ×Ö·û´®£¬µÚÒ»¸ö²ÎÊýÊÇ´ý²Ù×÷µÄ×Ö·û´®£»µÚ¶þ¸ö²ÎÊýÊÇҪɾ³ý²¿·ÖµÄÆðʼλÖ㻵ÚÈý¸ö²ÎÊýÊÇҪɾ³ý²¿·ÖµÄ³¤¶È£»µÚËĸö²ÎÊýÊÇÒª²åÈëµÄ×Ö·û´®£©
      £¨×¢ÒâËüºÍREPLACEµÄÇø±ð£ºSTUFF('ERTY23TY',3,2,'K')='ERK23TY"¶øREPLACE('ERTY23TY','TY','K')="ERK23K"£©
¡ñ¡¡REPLICATE('


Ïà¹ØÎĵµ£º

sqlserver ÉÏ»úÁ·Ï°Ìâ

 create database db
use db
go
create table course
(
 sno varchar(20),
 cno int ,
 Gmark int
)
insert into course values('20071513115',1,80)
insert into course values('20071513114',2,80)
insert into course values('20071513113',3,80)
insert into course values('20071513 ......

SQLServer 2008¿çÊý¾Ý¿âʵÀýÊÂÎñ´¦Àí

 ÍÐÁ˼¸ÌìµÄÄÑÌ⣬ÖÕÓÚ½â¾öÁË¡£ÌØ·ÖÏíÒ»ÏÂ
ÒÔÏÂÊÇÒ»¸ö´æ´¢¹ý³Ì
CREATE PROCEDURE deleteAccountAll
 @id int
AS
SET XACT_abort ON
BEGIN DISTRIBUTED TRAN
delete from AccountCapital where accountid = @id
delete from logininfo where username = @id
delete from CapitalRecord where accountid ......

ÔÚSqlServer´æ´¢¹ý³ÌÖÐʹÓÃCursor£¨Óα꣩²Ù×÷¼Ç¼

 
1. ΪºÎʹÓÃÓα꣺
    
ʹÓÃÓαê(cursor)µÄÒ»¸öÖ÷ÒªµÄÔ­Òò¾ÍÊǰѼ¯ºÏ²Ù×÷ת»»³Éµ¥¸ö¼Ç¼´¦Àí·½Ê½¡£ÓÃSQLÓïÑÔ´ÓÊý¾Ý¿âÖмìË÷Êý¾Ýºó£¬½á¹û·ÅÔÚÄÚ´æµÄÒ»¿éÇøÓòÖУ¬ÇÒ½á¹û
ÍùÍùÊÇÒ»¸öº¬Óжà¸ö¼Ç¼µÄ¼¯ºÏ¡£Óαê»úÖÆÔÊÐíÓû§ÔÚSQL serverÄÚÖðÐеطÃÎÊÕâЩ¼Ç¼£¬°´ÕÕÓû§×Ô¼ºµÄÒâÔ¸À´ÏÔʾºÍ´¦ÀíÕ ......

ʹÓÃÁÙʱ±íÌáÉýSqlServerÊÓͼ²éѯÐÔÄÜ

дÁËÒ»¸ö´æ´¢¹ý³Ì¶ÔÊÓͼ½øÐзÖÒ³²éѯ£¬µ«Êý¾ÝÔö¶àºó·¢ÏÖ»ùЧÂʵ͵ÃÒªÃü£¬ÈýÍò¶àÌõÊý¾ÝÒª²éѯһ¸ö°ëСʱ¶¼Ã»³öÀ´£¬Õâ²»ÊÇÒªÁËÃü£¬ÓÚÊÇÏëµ½ÁËË÷Òý£¬Ó¦ÓùýºóÈÔÎÞ¼ÃÓÚÊ¡£×îºó¶Ôsql½øÐзÖÎöºÍʵ¼ùÖеóö£¬Ê¹ÓÃÁÙʱ±í¿ÉÒÔ´ó´ó¼Ó¿ìÊÓͼµÄ²éѯËٶȣ¬¼ûÈçÏÂsqlÓï¾ä
ÐÔÄܳ¬µÍµÄÊÓͼ·ÖÒ³sqlÓï¾ä£º
select top 100 * from
view_c ......

sqlserver ÊÓͼ

/*drop table scourse
drop table course
drop table student
drop table major*/
create database db
use db
--רҵ±í
create table major
(spno char(5) not null primary key,
 spname varchar(20) not null,
 pno char(2) )
--ѧÉú±í
create table student
(sno char(7) not null primary key, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ