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

¶¯Ì¬sqlÓï¾ä»ù±¾Óï·¨

1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃExecÖ´ÐÐ
      Àý:      Select * from tableName
                Exec('select * from tableName')
                Exec sp_executesql N'select * from tableName'    -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
 
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
 
    ´íÎó:        declare @fname varchar(20)
                set @fname = 'FiledName'
                Select @fname from tableName              -- ´íÎó,²»»áÌáʾ´íÎ󣬵«½á¹ûΪ¹Ì¶¨ÖµFiledName,²¢·ÇËùÒª¡£
    ÕýÈ·:      Exec('select ' + @fname + ' from tableName')     -- Çë×¢Òâ¼ÓºÅǰºóµÄµ¥ÒýºÅµÄ±ßÉϼӿոñ
 
    µ±È»½«×Ö·û´®¸Ä³É±äÁ¿µÄÐÎʽҲ¿É
                declare @fname varchar(20)
                set @fname = 'FiledName' --ÉèÖÃ×Ö¶ÎÃû
 
                declare @s varchar(1000)
                set @s = 'select ' + @fname + ' from tableName'
                Exec(@s)                -- ³É¹¦
     


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

Ô·ݴ¦Àí¼°SQLʱ¼äÌõ¼þinstrº¯Êý

    YearCode:=yearof(Date);
      MonthCode:=monthof(Date);
      if  MonthCode>9 then
        FTime1:=inttostr(YearCode)+inttostr(MonthCode)
      else
 &nb ......

SQL²éѯÓï¾ä´óÈ« T

 --Óï ¾ä                                ¹¦ ÄÜ
1¡¢Êý¾Ý²Ù×÷
Select      --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
Insert & ......

Oracle SQLÓï¾ä²Ù×÷Êý×Ö£ºÈ¡Õû¡¢ËÄÉáÎåÈë¼°¸ñʽ»¯

 http://cheneyph.javaeye.com/blog/453492
ÓÃoracle sql¶ÔÊý×Ö½øÐвÙ×÷: È¡ÉÏÈ¡Õû¡¢ÏòÏÂÈ¡Õû¡¢±£ÁôNλСÊý¡¢ËÄÉáÎåÈë¡¢Êý×Ö¸ñʽ»¯
È¡Õû£¨ÏòÏÂÈ¡Õû£©£º 
select floor(5.534) from dual;
select trunc(5.534) from dual;
ÉÏÃæÁ½ÖÖÓ÷¨¶¼¿ÉÒÔ¶ÔÊý×Ö5.534ÏòÏÂÈ¡Õû£¬½á¹ûΪ5.
Èç¹ûÒªÏòÉÏÈ¡Õû £¬µÃµ½½á¹ûÎ ......

SQLÁª±í¸üУ¬Áª±í²éѯ

ûÓÐÒýÓùØÏµµÄ±í
 £±.¡¡Áª±í¸üÐÂ
update  a set a.education = '±¾¿Æ' from NT_UserInfo a ,NT_User b where  a.UserID=b.UserID and b.email = 'carlfan2008@163.com'
£².¡¡Áª±í²éѯ
select a.*,b.* from nt_user as a, nt_userinfo as b where a.userid = b.userid and Email = 'carlfan2008@163.com ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ