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

SQL ×Ö·û´®Óë16½øÖÆ»¥»»

ÔÚÍøÉÏ¿´µ½SQL×Ö·û´®×ª16½øÖƵÄÓï¾ä£¬¾­¹ýССÌí¼Ó£¬ÏÖ½«SQL×Ö·û´®Óë16½øÖÆ»¥»»µÄ·½·¨¼Ç¼£¬ÒÔ¹©ÒÔºó²é¿´¡£ 
--SQL char->HEX code
DECLARE @str VARCHAR(4000)
SET @str='SELECT * from dbo.TaskHistory' --Your sql char
DECLARE @i INT,@Asi INT,@ModS INT,@res VARCHAR(800),@Len INT,@Cres VARCHAR(4),@tempstr VARBINARY(400)
  SELECT @i = 1,@res='',@len=DATALENGTH(@str),@tempStr = CONVERT(VARBINARY,@str)
  WHILE @i<=@len
  BEGIN
     SELECT @Asi = SUBSTRING(@tempstr,1,1),@Cres=''
     WHILE @Asi <> 0
     BEGIN
       SELECT @Mods = @Asi %16,
       @Cres=CASE WHEN (@Mods > 9) THEN CHAR(ASCII('A')+@Mods-10)+@Cres ELSE CAST(@Mods AS VARCHAR(4)) + @Cres END,
       @Asi = @Asi/16
     END
     SELECT @res = @res + @Cres,@tempStr =  SUBSTRING(@tempStr,2,@len-1),@i = @i+1 
  END
SELECT '0x'+@res
--HEX code->SQL char
ÕâÀïʹÓÃ×î¼òµ¥µÄ·½Ê½£¬ÀûÓÃCastÖ±½Óת£¬ÕâÀïÓиöССµÄÎÊÌ⣬¿ÉÄܳöÏÖ×Ö·û±àÂë²»ÕýÈ·»òÂÒÂ룬µ±³öÏÖÕâÖÖÇé¿öʱ£¬½«varchar»»³Énvarchar,·´Ö®ÒàÈ»¡£
--HEX->SQL Char
DECLARE @S VARCHAR(4000);
SET @S=CAST(
0x53454C454354202A2046524F4D2064626F2E5461736B486973746F7279 --your hex code
 AS VARCHAR(4000));
SELECT @S


Ïà¹ØÎĵµ£º

SQLÊý¾Ý¿âÖ®¶þ

l  INNER JOIN
ÄÚÁ¬½ÓÊÇ×î³£¼ûµÄÒ»ÖÖÁ¬½Ó£¬ËüÒ³±»³ÆΪÆÕͨÁ¬½Ó£¬¶øE.FCodd×îÔç³Æ֮Ϊ×ÔÈ»Á¬½Ó¡£
ÏÂÃæÊÇANSI SQL£­92±ê×¼
select *  from    t_institution i
inner join t_teller t
on i.inst_no = t.inst_no  //˵Á½¸ö±íÖ®¼äµÄ¹ØϵÓÃON
where i.inst_no = "5801"
ÆäÖÐinner¿ÉÒÔÊ¡Â ......

SQLÊý¾Ý¿â

 CURSOR
==================================
l  SQL ÓαêCURSORµÄʹÓÃ
 
ʹÓÃÆðÀ´ºÜ¼òµ¥£¬Ïȶ¨Ò壬Ȼºó¸³¸öÖµ£¬´ò¿ª£¬Í¨¹ýWhile Loop Ò»¸öÒ»¸ö¶ÁÏÂÈ¥£¬×îºó¹Ø±Õ£¬ÊÍ·ÅÄÚ´æ¡£»ù±¾Ì×·ÈçÏ£º
DECLARE MyCursor cursor /* ÉùÃ÷Óα꣬ĬÈÏΪµ¥´¿ÏòÇ°µÄÓαꡣÈç¹ûÏëҪǰºóÌøÀ´ÌøÈ¥µÄ£¬Ð´³ÉScroll Cursor¼ ......

sqlÓï¾ä ½Øȡʱ¼ä Ö»ÏÔʾ Ä꣬Ô£¬Èյĸñʽ


Õª×Ôhttp://blog.sina.com.cn/zhm85
SQLÓï¾ä½Øȡʱ¼ä£¬Ö»ÏÔʾÄêÔÂÈÕ£¨2004-09-12£©
select CONVERT(varchar, getdate(), 120 )
‘getdate£¨£©’¸ÄΪʱ¼ä×Ö¶ÎÃû‘createtime’
ÔÙÖØÃüÃûмÓÁУ¨Select Name AS UName from Users£©
ÀýÈç select convert(varchar(11),createtime,120) as Ndate fro ......

SQL SERVER 2005 »ù±¾²éѯ£¨Á¬½Ó²éѯ£©

use AdventureWorks
GO
SELECT c.LastName from Person.Contact c;
SELECT * from HumanResources.Employee e
INNER JOIN HumanResources.Employee m
 ON e.ManagerID = m.EmployeeID; n
SELECT ProductID,Name,ProductNumber,ReorderPoint
from Production.Product
where ProductID in( select ProductID fro ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ