Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ʱ¼ä¶Î²éѯ


SQLʱ¼ä¶Î²éѯ
ACCESSµÄ»°
select * from table where date1<#2008-1-20# and date2>#2007-8-30#
MYSQLµÄ»°
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
Ò²¿ÉÒÔ
select * from table where date1 between '2008-1-20' and '2007-3-30'
ÆäÖÐdate1,date2¶¼ÊÇÈÕÆÚÀàÐ͵Ä× ......

PL/SQLʵÓÃС¼¼ÇÉ

 1. Ö±½ÓÔÚPL/SQL ÖÐÐÞ¸ÄÊý¾Ý
     selectÓï¾äºóÃæ¼Ó‘for updata’£¬´ò¿ª½çÃæÉϵÄСËø£¬±à¼­£¬°´¹³¹³±£´æ¡£
     eg: select * from xtgldxsyncdw for update; ²éѯ½á¹û´°¿ÚµÄСËø¼´¿É´ò¿ª¡£
2. µ¼È˵¼³ötables
     tools -->import ......

MS SQL2000Êý¾Ý¿â×Ô¶¯±¸·ÝµÄ¼¸ÖÖ·½·¨£¨ms sql 2000 £©

Ò»¡¢¼òµ¥ÊµÓõı¸·Ý·½·¨£º
ÆóÒµ¹ÜÀíÆ÷ÖеÄTools£¬Database Maintenance Planner£¬¿ÉÒÔÉèÖÃÊý¾Ý¿âµÄ¶¨ÆÚ×Ô¶¯±¸·Ý¼Æ»®¡£²¢Í¨¹ýÆô¶¯Sql server AgentÀ´×Ô¶¯ÔËÐб¸·Ý¼Æ»®¡£¾ßÌå²½ÖèÈçÏÂ:
1¡¢´ò¿ªÆóÒµ¹ÜÀíÆ÷£¬ÔÚ¿ØÖÆ̨¸ùĿ¼ÖÐÒÀ´Îµã¿ªMicrosoft SQL Server-->SQL Server×é-->Ë«»÷´ò¿ªÄãµÄ·þÎñÆ÷
2¡¢È»ºóµãÉÏÃæ²Ëµ¥ÖÐ ......

¾­µäSQLÓï¾ä´óÈ«

ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
¡¡¡¡SQL·ÖÀࣺ
¡¡¡¡DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
¡¡¡¡DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
¡¡¡¡DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
¡¡¡¡Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
¡¡¡¡1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ