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

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


Ïà¹ØÎĵµ£º

SQL ServerÖи÷Êý¾ÝÀàÐͳߴ磨Byte£©


Êý¾ÝÀàÐÍ
´æ´¢³ß´ç
ÃèÊö
bigint
8 bytes
¡¡
integer
4 bytes
¡¡
smallint
2 bytes
¡¡
tinyint
1 byte
¡¡
bit
1 byte
¡¡
numeric(p,s)
decimal(p,s)
dec(p,s)
19 bytes
¡¡
money
8 bytes
¡¡
float
8 bytes
¡¡
real
4 bytes
¡¡
datetime
8 bytes
¡¡
nvarchar(n)
2*³¤¶È bytes
¡¡
nte ......

SQLÖд¦Àíʱ¼äÎÊÌâ°¸Àý

1. »ñÈ¡Êý¾Ý¿âÖе±Ç°Ô·ݵÄÏà¹ØÊý¾Ý
SELECT WorkerSortID, SUM(WorkerCount) AS WorkerMothCount
from WorkerRecord
WHERE (YEAR(WorkerTime) = YEAR({ fn NOW() })) AND (MONTH(WorkerTime)
      = MONTH({ fn NOW() })) AND (WorkerCount > 0) AND (WorkerID = 'wy')
GROUP BY Worker ......

SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓ㨶þ£©

Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¸ÄÉÆSQLÓï¾ä
¡¡¡¡ºÜ¶àÈ˲»ÖªµÀSQLÓï¾äÔÚSQL SERVERÖÐÊÇÈçºÎÖ´Ðеģ¬ËûÃǵ£ÐÄ×Ô¼ºËùдµÄSQLÓï¾ä»á±»SQL SERVERÎó½â¡£±ÈÈ磺
select * from table1 where name=''zhangsan'' and tID > 10000
ºÍÖ´ÐÐ:
select * from table1 where tID > 10000 and name=''zhangsan''
¡¡¡¡Ò»Ð©È˲»ÖªµÀ ......

¹ØÓÚsqlÈÕÖ¾Îļþ

 Ò»¶Îʱ¼äÀ´£¬Ã¿ÌìµÄ¹¤×÷¶¼±È½ÏÔÓ£¬vb,asp,c#,sql£¬Ã¿Ï×÷¶¼Òª¸ã£¬ÊµÔÚÊÇÀÛ£¡¹¤×÷Ö®Ó࣬ÏëÏ빫˾ºÍ¹¤×÷µÄÇé¿ö£¬¿´À´ÊÇÓбØÒª»»¸ö»·¾³ÁË¡£²»¹ýÒ²ÒªÏȰÑĿǰµÄ¹¤×÷´¦ÀíÍê³É°¡¡£
      ×î½üÓÖÓöµ½Ò»¸öÎÊÌ⣺һ¼Ò¿Í»§Ê¹ÓÃÖеÄÊý¾Ý¿â£¬ÈÕÖ¾ÎļþÒì³£Ôö´ó£¬Æ½¾ùÿÌìÔö¼Ó´óÔ¼Ò»¸öG£¬¶øÊý¾ÝÎļþ±ä» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ