ÓÃSQLÓï¾äÆ´½ÓÊý¾Ý¿â±íÖÐÒ»ÁеÄÊý¾Ý
×î½üÔÚÒ»¸öÏîÄ¿ÖÐÓöµ½ÐèÒªÔÚÊý¾Ý²ã¾ÍÆ´½Ó±íÖÐÒ»ÁÐÊý¾ÝµÄÎÊÌâ¡£
ÀýÈ磬test±íÖÐÓиö×Ö¶Ît,tÁÐÖеÄ4ÐÐÊý¾ÝΪ1,2,3,4 £¬ÒªÆ´½Ó³É1+2+3+4£¬×ÁÄ¥ÁËÒ»Õ󣬱¾À´ÏëÓÃÓα꣬µ«ÊÇЧÂÊ¡£¡£ºóÀ´ÕÒµ½Ò»¶ÎSQL£¬¿ÉÒԺܷ½±ãµØÆ´½Ó¡£
DECLARE @STR VARCHAR(8000) ----¶¨Òå²éѯ×Ö·û´®
SELECT @STR=ISNULL(@STR+'+','')+t from (SELECT DISTINCT t from test)AS Temp ----Æ´½Ó²éѯ×Ö·û´®
SELECT @STR -----Ö´ÐÐ
Ïà¹ØÎĵµ£º
´íÎóÌáʾ£º
Ö¸¶¨µÄÁ¬½ÓÀàÐÍ“OLEDB”δ±»Ê¶±ðΪÓÐЧµÄÁ¬½Ó¹ÜÀíÆ÷ÀàÐÍ¡£µ±ÊÔͼ´´½¨Î´ÖªÁ¬½ÓÀàÐ͵ÄÁ¬½Ó¹ÜÀíÆ÷ʱ»á·µ»Ø´Ë´íÎó¡£Çë¼ì²éÁ¬½ÓÀàÐÍÃû³ÆµÄƴдÊÇ·ñÕýÈ·¡£
½â¾ö·½·¨£º
sqlserver2005-ÅäÖù¤¾ß-SqlServer configuration manager-SqlServer2005·þÎñ-sqlserver Integration Services£¬ÓÒ»÷-Ñ¡ÔñÊôÐÔ£¬È»ºó° ......
SQL SERVER 2005µÄȺ¼¯±ØÐëÔÚʵÏÖÁËWINDOWSȺ¼¯µÄ»ù´¡ÉϲſÉÒÔ¡£
Ê×ÏÈÎÒÃÇÏÈÀ´¿´Ò»ÏÂSQL SERVER 2005Ⱥ¼¯µÄһЩÏà¹Ø½éÉÜ£º
ÔÚSQL SERVER 2005ÖÐÖ÷Òª¿ÉÒÔʹÓþµÏñºÍȺ¼¯Á½ÖÖ·½·¨À´ÊµÏָ߿ÉÓÃÐÔ£¬ÖÁÓÚÊý¾Ý¿â¾µÏñ×÷ΪSQL SERVER 2005µÄÐÂÌØÐÔÖ®Ò»£¬ÎÒÔÚÇ°ÃæµÄ²©ÎÄÒѾ×öÁ˽éÉÜ£¬½ñÌìÎÒÃǾÍÀ´¿´Ò»ÏÂȺ¼¯µÄÅäÖ÷½·¨£ºµ±È»Ëüà ......
Ò»¡¢·Öҳд·¨Ð¡Àý£º
SELECT FIRST 10 templateid,code,name from template ;
SELECT FIRST 10 SKIP 10 templateid,code,name from template ;
SELECT * from shop ROWS 1 TO 10; –firebird2.0Ö§³ÖÕâÖÖд·¨
¶þ¡¢ÏÔʾ±íÃûºÍ±í½á¹¹
SHOW TABLES;
SHOW TABLE tablename;
ËÄ¡¢¸üÐÂ×Ö¶Î×¢ÊÍ
......
Òª´´½¨Á½¸öÎļþ
1: runBatch.bat
2: sql.txt
runBatch.bat ÄÚÈÝÈçÏ£º
sqlplus username/password @sql.txt
pause
sql.txtÄÚÈÝÈçÏ£º
spool sql.log
create table t1(cname char(20));
insert into t1(cname) values('test');
select * from t1;
spool off
exit
Ë«»÷runBatch.bat¾Í¿ÉÒÔÅúÁ¿Ö´ÐÐsql.txtÖÐ ......
to_dateºÍto_charÊÇoracleÀïÀïÃæµÄÄÚÖú¯Êý¶ø²»ÊDZê×¼µÄsqlÓï·¨Öеĺ¯Êý£¬Ó÷¨¾ÙÀý£º
1.to_char£¬·µ»Ø½á¹û¿ÉÏÔʾΪ¸÷ÖÖÐÎʽ
select to_char(sysdate,'yyyy/mm/dd') ,sysdate from dual;
½á¹û£º 2010/05/26 &nbs ......