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

ʹÓÃSQL Serverµ¼Èë/µ¼³öExcel

ʹÓÃSQL Serverµ¼Èë/µ¼³öExcel,°üº¬²¿·Ö´íÎóÐÅÏ¢´¦Àí·½·¨;
²Ù×÷ÊÖ¼Ç,Áô´Ë±¸²é
/*
µ¼Èë
*/
--´íÎóÐÅÏ¢ÈçÏÂʱ£º
--Msg 15281, Level 16, State 1, Line 2
--SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
--ÇëÑ¡ÔñÖ´ÐÐÏÂÃæÓï¾ä,ÐÞ¸ÄĬÈÏÅäÖÃ,ÔÚ½øÐе¼Èë²Ù×÷
-- begin
sp_configure 'show advanced options',1
RECONFIGURE WITH override
go
sp_configure 'Ad Hoc Distributed Queries',1 -- 1:ÆôÓÃ,ĬÈÏ0:½ûÓÃ
RECONFIGURE WITH override
go
EXEC sp_configure;
go
-- end
-- ²éѯ
select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=D:\ExcelSheet1.xls',sheet1$)
go
-- ²éѯ²¢µ¼Èë
select * into ExcelSheet from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=D:\ExcelSheet1.xls',sheet1$)
go
/*
µ¼³ö
*/
--´íÎóÐÅÏ¢ÈçÏÂʱ£º
--Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
--SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
--ÇëÑ¡ÔñÖ´ÐÐÏÂÃæÓï¾ä,ÐÞ¸ÄĬÈÏÅäÖÃ,ÔÚ½øÐе¼³ö²Ù×÷
-- begin
sp_configure 'show advanced options',1
RECONFIGURE WITH override
go
sp_configure 'xp_cmdshell',1 -- 1:ÆôÓÃ,ĬÈÏ0:½ûÓÃ
RECONFIGURE WITH override
go
EXEC sp_configure;
go
-- end
--Ìí¼Óµ½ÏÖÔÚExcelÎĵµ
insert into OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=D:\ExcelSheet.xls',sheet1$)
go
--´øÁ¬½ÓÐÅÏ¢µ¼³ö
EXEC master..xp_cmd


Ïà¹ØÎĵµ£º

SQL Server 2005ÖеÄÎļþºÍÎļþ×é(¶þ)

--> Title  : SQL Server 2005ÖеÄÎļþºÍÎļþ×é(¶þ)
--> Author : wufeng4552
--> Date   : 2010-1-13
SQL Server 2005ÖеÄÎļþºÍÎļþ×é(¨ç) Ö÷Òª講½âÁËÀí論²¿·Ö
http://blog.csdn.net/wufeng4552/archive/2009/10/23/4716053.aspx
SQL Server 2005ÖеÄÎļþºÍÎļþ×é(¶þ) Ö÷Òª ......

Àí½â SQL Server ÖÐϵͳ±íSysobjects

×ÜÓû§±í:select count(*) ×ܱíÊý from sysobjects where xtype='u'
×ÜÓû§±íºÍϵͳ±í:select count(*) ×ܱíÊý from sysobjects where xtype in('u','s')
×ÜÊÓͼÊý:select count(*) ×ÜÊÓͼÊý from sysobjects where xtype='v'
×Ü´æ´¢¹ý³ÌÊý:select count(*) ×Ü´æ´¢¹ý³ÌÊý from sysobjects where xtype='p'
×Ü´¥·¢Æ÷Êý:s ......

SQL SERVERµÄ·ÖÀà»ã×Ü

SQL SERVERµÄ·ÖÀà»ã×Ü
SQL SERVERÖÐʹÓÃGROUP BY¶ÔÊý¾Ý½øÐзÖÀà»ã×Ü£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃWITH ROLLUPºÍWITH CUBEÅäºÏGROUP BY½øÐГÔöÇ¿”Á˵ķÖÀà»ã×Ü£¬ÄÇôËûÃÇÁ½¸öÊÇÈçºÎÔöÇ¿GROUP BYµÄ»ã×ÜÄÜÁ¦µÄÄØ£¿
Ò».¹¦ÄÜÔöÇ¿
1.ʹÓÃWITH ROLLUP
ÓÃÏÂÃæµÄÀý×Ó˵Ã÷,GROUPʹÓÃÁË3¸ö·Ö×é×ֶΣºGROUP BY A, B, C WITH ROLLUP ......

ÔõÑùÓÃSQLÓï¾äÅжÏÒ»¸öÊý¾Ý±íÖÐÖÁÉÙNÏΪ¿Õ£¿£¿£¿

ǰÁ½ÌìÒ»¸öѧ½ãÎÊÎÒ¸öSQLÓï¾äµÄÎÊÌ⣬ÏÖÔڰѽâ¾ö·½°¸Ìù³öÀ´£¬Ò²Ëã×ܽáһϰɡ£
ËýµÄÎÊÌâÊÇ£º“Ò»¸ö±íÖÐÓÐ15¸ö×ֶΣ¬ÓÃSQLÓï¾äÅÐ¶ÏÆäÖÐ5Ïî»òÒÔÉϲ»Îª¿Õ£¬ÔõôÅжϣ¬ºÜ¼±……”¡£
µ±Ê±Î񼆾£¬Ã»¶à¿´£¬ºÇºÇ£¬²»¹»Òâ˼À²¡£µ«ÎÒÇëͬʰïËýдÁ˸ö£¬ÒÔ½âȼü֮¼±£¬ÔÚ´ËҲллСÃס£
½ñÌìÔÙ°ÑQQÁÄÌì¼Ç¼· ......

SQL ÈçºÎɾ³ýÊý¾Ý±íÖÐÖØ¸´µÄÊý¾Ý£¿

¡¾ÒýÓãºÃÍáï¼¼ÊõÎÄÕÂÕªÒª
¡¿
¾­²âÊÔ£¬·½·¨¶þ¿É³É¹¦É¾³ýÊý¾Ý£¬·½·¨Ò»¡¢Èý ɾ³ýÊý¾Ýʧ°Ü¡£Çë·¹ýµÄÅóÓÑ£¬Ö¸µãÃÔ½ò¡£¡£¡£
ÎÊÌ⣺һ¸ö±íÓÐ×ÔÔöµÄID
ÁУ¬±íÖÐÓÐһЩ¼Ç¼ÄÚÈÝÖØ¸´£¬Ò²¾ÍÊÇ˵ÕâЩ¼Ç¼³ýÁËID
²»Í¬Ö®Í⣬ÆäËûµÄÐÅÏ¢¶¼Ïàͬ¡£ÐèÒª°ÑÖØ¸´µÄ¼Ç¼±£ÁôÒ»Ìõ£¬Ê£ÏµÄɾ³ý
 
·½·¨Ò»£º»¹ÊÇ2000
ÄêµÄʱºòһλOracl ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ