sql float ת varchar
SELECT CONVERT(varchar(100), CAST(@testFloat AS decimal(38,2)))
SELECT STR(@testFloat, 38, 2)
´ÓExcelÖе¼Èëµ½sql2000£¬ÓÐÒ»ÁГÁªÏµ·½Ê½”±ä³ÉÁËfloatÀàÐÍ£¬ÎÒÏëת»»³ÉnvarcharÀàÐÍ£¬ÓÃÏÂÃæµÄÓï¾ä
select convert(nvarchar(30),convert(int,ÁªÏµ·½Ê½)) from employee
go
//Êý¾ÝÒç³ö£¬²»ÐУ¡
select convert(nvarchar(30),convert(decimal(11,0),ÁªÏµ·½Ê½)) from employee
go
//Êý¾Ýת»»³É¹¦£¡
SELECT CONVERT(nvarchar(100), CAST(ÁªÏµ·½Ê½ AS decimal(11,0))) from employee
go
//Êý¾Ýת»»³É¹¦£¡
SELECT STR(ÁªÏµ·½Ê½, 11, 0)from employee
go
//Êý¾Ýת»»³É¹¦£¡
×ܽᣬfloat---decimal----nvarchar
convert
cast
str
²Î¿¼£ºhttp://www.itwis.com/html/database/sqlserver/20090828/5827.html
Ïà¹ØÎĵµ£º
²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ
1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
4¡¢ÄÚ´æ²»×ã
5¡¢ÍøÂçËÙ¶ÈÂý
6¡¢²éѯ³öµÄÊý¾ÝÁ¿¹ý´ó£¨¿ÉÒÔ²ÉÓöà´Î²éѯ£¬ÆäË ......
Cross Applyʹ±í¿ÉÒԺͱíÖµº¯Êý½á¹û½øÐÐjoin£¬ÔÚÏÂÃæµÄʾÀýÖн¨ÁËÁ½¸ö±íºÍÒ»¸ö±íÖµº¯Êý£¬T_bµÄÁÐa_idsÖлá´æ·Åa±íµÄidÓÃ,·Ö¸îµÄ×Ö·û´®Á¬½Ó£»ÎÒÃÇͨ¹ýcross applyʹT_a£¬T_b±íͨ¹ýsplitIDs inner join Á¬½Ó¡£Ç뿴ʾÀý£ºGO
if object_id('T_a','U') is not null
drop table T_a
GO
CREATE TABLE T_a( ......
ÔÚ±¾ÎÄÖУ¬GetDate()»ñµÃµÄÈÕÆÚÓÉÁ½²¿·Ö×é³É£¬·Ö±ðÊǽñÌìµÄÈÕÆں͵±Ê±µÄʱ¼ä£ºSelect GetDate() ÓÃDateName()¾Í¿ÉÒÔ»ñµÃÏàÓ¦µÄÄê¡¢Ô¡¢ÈÕ£¬È»ºóÔÙ°ÑËüÃÇÁ¬½ÓÆðÀ´¾Í¿ÉÒÔÁË£º
¡¡¡¡
Select Datename(year,GetDate())+'-'+Datename(month,GetDate())+'-'+Dat ......
Ò»¶Îʱ¼äÀ´£¬Ã¿ÌìµÄ¹¤×÷¶¼±È½ÏÔÓ£¬vb,asp,c#,sql£¬Ã¿Ï×÷¶¼Òª¸ã£¬ÊµÔÚÊÇÀÛ£¡¹¤×÷Ö®Ó࣬ÏëÏ빫˾ºÍ¹¤×÷µÄÇé¿ö£¬¿´À´ÊÇÓбØÒª»»¸ö»·¾³ÁË¡£²»¹ýÒ²ÒªÏÈ°ÑÄ¿Ç°µÄ¹¤×÷´¦ÀíÍê³É°¡¡£
×î½üÓÖÓöµ½Ò»¸öÎÊÌ⣺һ¼Ò¿Í»§Ê¹ÓÃÖеÄÊý¾Ý¿â£¬ÈÕÖ¾ÎļþÒì³£Ôö´ó£¬Æ½¾ùÿÌìÔö¼Ó´óÔ¼Ò»¸öG£¬¶øÊý¾ÝÎļþ±ä» ......
--> Title : SQL Server 2005ÖеÄÎļþºÍÎļþ×é
--> Author : wufeng4552
--> Date : 2009-10-23
1¡¢ÎļþºÍÎļþ×éµÄº¬ÒåÓë¹Øϵ
ÿ¸öÊý¾Ý¿âÓÐÒ»¸öÖ÷Êý¾ÝÎļþ.ºÍÈô¸É¸ö´ÓÎļþ¡£ÎļþÊÇÊý¾Ý¿âµÄÎïÀíÌåÏÖ¡£ Îļþ×é¿ÉÒÔ°üÀ¨·Ö²¼ÔÚ¶à¸öÂß¼·ÖÇøµÄÎļþ£¬ÊµÏÖ¸ºÔØƽºâ¡£Îļþ×éÔÊÐ ......