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

MSSQLµÄһЩÓ÷¨¼¯ºÏ

ÔÚselect語¾äÀïÃæ¿ÉÒÔʹÓÃcase來對ij個colmunµÄÖµ進ÐзÖ別處Àí£¬±ÈÈç
select case color
when 1 then 'red'
when 2 then 'green'
when 3 then 'blue'
else 'black'
end as 'colorName',
foodName from foods
Èç¹ûʹÓÃÁËleft joinµÄ時ºò£¬Ä³個columnµÄnullÖµÐèÒª給Ò»個default valueµÄ話£¬Ò²¿ÉÒÔÈçÏ£º
select foodName, case 
when foodPrice is null then 0
else foodPrice
end as price,
foodCost from foods left join foodPrices on foods.foodId = foodPrices.foodId
»òÕß
when nullif(foodPrice, null) is null then 0


Ïà¹ØÎĵµ£º

MsSql³£ÓÃÈÕÆÚ¸ñʽ

SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄܾ­³£»áÓõ½µÄÈÕÆÚ¸ñʽת»»·½·¨:
¾ÙÀýÈçÏÂ:
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVER ......

JspÁ¬½ÓMSSQL2000µÄÁ½ÖÖ·½·¨


JspÁ¬½ÓMSSQL2000µÄÁ½ÖÖ·½·¨
×î½üÔÚѧϰJSPWeb£¨Tomcat·þÎñÆ÷£©Ó¦Óÿª·¢ºÍ»ùÓÚWeblogicºÍMyelcipseµÄJEE5µÄ¿ª·¢£¬ÔÚѧϰ¹ý³ÌÖÐÉæ¼°µ½Á¬½ÓSQL 2000 Êý¾Ý¿âʱ£¬ÓÉÓÚÈí¼þ»·¾³µÄ²îÒìÐÔºÍһЩ°æ±¾ÎÊÌ⣬»¨Á˺ô󹦷ò²ÅÁ¬ÉÏ£¬ËùÒÔÔÚ´Ë×÷¸ö×ܽᣬϣÍûÄܸø´ó¼ÒһЩ°ïÖú£¬²»ÒªÔÚ»ù±¾µÄ¶«Î÷ÉÏ»¨·ÑÌ«¶àµÄʱ¼ä¡£
·½·¨Ò»£ºÀûÓÃSQL Se ......

mssqlµÇ¼ÃûºÍÿ¸öÊý¾Ý¿âµÄÓû§µÄÇø±ðÁªÏµ


ÈçͼËùʾ£¬ÔÚ°²È«ÐÔ-µÇ½Àï¿ÉÒÔ¿´µ½ÓÒ±ßÁбíÀïµÄÓû§£¬Ñ¡ÖÐÓû§ÓÒ¼ü-ÊôÐÔ¿ÉÒÔ¸ü¸ÄÓû§ÃÜÂ룬¼°Êý¾Ý¿â½ÇÉ«µÈ¡£
²é¿´Óû§Ãû£¬¼°ÃÜÂëÊÇ·ñÕýÈ·£¬¿ÉÒÔµ¥¶ÀµÇ½ ²éѯ·ÖÎöÆ÷
Èç¹ûÄܵǽ˵Ã÷ÉèÖÃÕýÈ·£¬ÔÚmssql´î½¨µÄasp cmsÀï¾­³£ÒªÓõ½Óû§Ãû£¬ÃÜÂë¡£
ÏÖÔÚ¿´Ã¿¸öÊý¾ÝÏÂÃæµÄÓû§Ñ¡ÏÈçͼ
Ñ¡ÖÐÒ»¸öÒ»¸öÊý¾Ý¿â£¬»òÏÂÃæµÄÓû§Ñ ......

C#ʹÓÃSQLDMOʵÏÖ¶ÔMSSQLÊý¾Ý¿â½øÐб¸·ÝºÍ»Ö¸´

public sealed class DbOper
{
     ///<summary>
     /// DbOperÀàµÄ¹¹Ô캯Êý
     ///</summary>
     private DbOper()
     {
     }
     ......

MSSQL ½øÖÆת»»

-- ÈÎÒâ½øÖÆת»»Îª10½øÖÆ
-- Àý 0FA ת»»Îª 16½øÖÆ select dbo.f_BinaryToInt('0123456789ABCDEF', '0FA')
CREATE   function   dbo.f_BinaryToInt(@BinaryFormate varchar(100), @num   varchar(200))  
--@BinaryFormate Ϊ×Ô¶¨ÒåµÄ½øÖƸñʽ
--@num ΪҪת»»³É10½øÖƵÄ×Ô¶¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ