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

SQLServerÖÐÓõıȽ϶àµÄº¯Êý

ÏÂÃæÊÇÎÒÔÚSQLServerÖÐÓõıȽ϶àµÄº¯Êý£¬Ä㻹ÓÃЩʲôº¯Êý£¿»òÕß¶ÔÄĸöº¯ÊýÓбȽϺÃÓ÷¨£¿»òÕßÄã²»ÓÃÄÄЩº¯Êý£¿
LEFT ( character_expression , integer_expression )
·µ»Ø´Ó×Ö·û´®×ó±ß¿ªÊ¼Ö¸¶¨¸öÊýµÄ×Ö·û¡£
Àý:
select left('my name is viwo',4)
my n
RIGHT ( character_expression , integer_expression )
·µ»Ø×Ö·û´®ÖдÓÓұ߿ªÊ¼Ö¸¶¨¸öÊýµÄ integer_expression ×Ö·û¡£
Àý:
select right('my name is viwo',4)
viwo
CAST ( expression AS data_type )
½«Ä³ÖÖÊý¾ÝÀàÐ͵ıí´ïʽÏÔʽת»»ÎªÁíÒ»ÖÖÊý¾ÝÀàÐÍ¡£CAST ºÍ CONVERT ÌṩÏàËÆµÄ¹¦ÄÜ¡£
Àý:
select cast(2 as varchar(10))+cast(11 as varchar(10))
211
CONVERT (data_type[(length)], expression [, style])
½«Ä³ÖÖÊý¾ÝÀàÐ͵ıí´ïʽÏÔʽת»»ÎªÁíÒ»ÖÖÊý¾ÝÀàÐÍ¡£CAST ºÍ CONVERT ÌṩÏàËÆµÄ¹¦ÄÜ¡£
Àý:
select convert(varchar,getdate(),112)
20070328
DATEADD ( datepart , number, date )
ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ¡£
Àý:
select dateadd(month,2,getdate())
2007-05-28 14:24:37.280
COALESCE ( expression [ ,...n ] )
·µ»ØÆä²ÎÊýÖеÚÒ»¸ö·Ç¿Õ±í´ïʽ¡£
Àý:
select coalesce(null,null,0)
0
select coalesce(2,3,0)
2
CHARINDEX ( expression1 , expression2 [ , start_location ] )
·µ»Ø×Ö·û´®ÖÐÖ¸¶¨±í´ïʽµÄÆðʼλÖá£
Àý:
select charindex('ab','eabcd')
2
LTRIM ( character_expression )
ɾ³ýÆðʼ¿Õ¸ñºó·µ»Ø×Ö·û±í´ïʽ¡£
Àý:
select ltrim('   abc    ')
abc        
RTRIM ( character_expression )
½Ø¶ÏËùÓÐÎ²Ëæ¿Õ¸ñºó·µ»ØÒ»¸ö×Ö·û´®¡£
Àý:
select rtrim('   abc    ')
   abc
ROUND ( numeric_expression , length [ , function ] )
·µ»ØÊý×Ö±í´ïʽ²¢ËÄÉáÎåÈëΪָ¶¨µÄ³¤¶È»ò¾«¶È¡£
Àý:
select ROUND(748.585, 2)
748.590
FLOOR ( numeric_expression )
·µ»ØÐ¡ÓÚ»òµÈÓÚËù¸øÊý×Ö±í´ïʽµÄ×î´óÕûÊý¡£
Àý:
select floor(748.585)
748
CEILING ( numeric_expression )
·µ»Ø´óÓÚ»òµÈÓÚËù¸øÊý×Ö±í´ïʽµÄ×îСÕûÊý¡£
Àý:
select ceiling(748.585)
749
REPLACE ( 'string_expression1' , 'string_expression2' , 'string_expression3' )
ÓõÚÈý¸ö±í´ïÊ½Ìæ»»µÚÒ»¸ö×Ö·û´®±í´ïʽÖ


Ïà¹ØÎĵµ£º

sqlserver ÐÞ¸ÄÅÅÐò¹æÔò

ǰÕóÓöµ½ ±¾µØsqlserver2005¿ç¿â²éѯ
½á¹ûÊ×Ïȱ¨´íµÄÊÇ ÎÞ·¨ ´¦Àí²»Í¬µÄÅÅÐò¹æÔò
ÔÚÐÞ¸ÄÅÅÐò¹æÔòµÄ¹ý³ÌÖУ¬ÓÖ³öÏÖÁË£¬“ÎÞ·¨ÓÃÅÅËûËøËø¶¨¸ÃÊý¾Ý¿â£¬ÒÔÖ´ÐиòÙ×÷¡£”ÕâÑùµÄ´íÎó¡£
¾­²é×ÊÁÏ·¢ÏÖ£¬ÐÞ¸ÄÊý¾Ý¿âΪµ¥Óû§·ÃÎÊ£¬¿ÉÒÔËø¶¨Êý¾Ý¿â¡£
alter database yourdatabase set single_user with rollback  ......

sqlserver ×Ô¶¨Ò庯ÊýËæ»ú²úÉúÖ¸¶¨·¶Î§µÄËæ»úÊý

/*
--´´½¨ÊÓͼ
create view RandomView as select re=rand()
--×Ô¶¨Ò庯Êý:È¡µÃÖ¸¶¨·¶Î§µÄËæ»úÊý
create function RandData(
@a int,
@b int)
returns decimal(38,0)
as
begin
declare @r decimal(38,0)
select @r=cast(re*(@b-@a)+@a as decimal(38,0)) from RandomView
return(@r)
end
go
s ......

SQLServer ±í²éѯÖÐµÄ ºÏ²¢²éѯ ºÏ¼¯ ²î¼¯ ½»¼¯

use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
create table t1 (a int )
insert into t1 select 1 union select 2 union select 3
create table t2 (a int )
insert into t2 select 3 union select 4 union select 5
go
sele ......

SQLServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î(ת)

SQL ServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î
1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹ØÏµ
¡¡¡¡¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµÄ¹ØÏµ¡£ÔÚÒ»°ãÇé¿öÏ£¬ËüÃÇÊÇÒ»¶ÔÒ»µÄ¹ØÏµ£º¼´Ò»ÕÅԭʼµ¥¾Ý¶ÔÓ¦ÇÒÖ»¶ÔÓ¦Ò»¸öʵÌå¡£ÔÚÌØÊâÇé¿öÏ£¬ËüÃÇ¿ÉÄÜÊÇÒ»¶Ô¶à»ò¶à¶ÔÒ»µÄ¹ØÏµ£¬¼´Ò»ÕÅԭʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ壬»ò¶àÕÅԭʼµ¥Ö¤¶ÔÓ¦Ò»¸öʵÌå¡£ÕâÀïµÄʵÌå¿ÉÒÔÀí½âΪ»ù±¾±í¡£Ã ......

mysql,sqlserver,oracleÈýÖÖÊý¾Ý¿âµÄ´ó¶ÔÏó´æÈ¡


mysql ´ó¶ÔÏó´æÈ¡:
ÀàÐÍÒ»°ãÓ¦¸ÃÓÃmediumblod,
blobÖ»ÄÜ´æ2µÄ16´Î·½¸öbyte,
mediumblodÊÇ24´Î·½,
Ò»°ãÀ´Ëµ¹»ÓÃÁË.longblobÊÇ32´Î·½ÓÐЩ´ó.
MYSQLĬÈÏÅäÖÃÖ»ÄÜ´æ1M´óСµÄÎļþ,ÒªÐÞ¸ÄÅäÖÃ,WIN°æ±¾µÄÔÚmysql.iniÎļþÖÐ
ÐÞ¸Ämax_allowed_packet,net_buffer_lengthµÈ¼¸¸ö²ÎÊý,»òÖ±½ÓSET GLOBAL varName=value.
linux°æ± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ