ʹÓÃ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µÄģʽƥÅäÔËË㣬½Ó×ÅÏëµ½ÁËͨÅä·ûµÄתÒåÎÊÌ⣬ÒòΪ̫¾ÃûÓã¬GoogleÁËËÑË÷ÁËһϲÅÏëÆðÀ´£¬Ð´¼¸¾ä»°¼Ç¼Ï¡£ ¹ØÓÚͨÅä·ûµÄתÒ壬sql serverÀï±ßÌṩÁ˹ؼü×ÖescapeÀ´´¦Àí¡£µ«ÊÇescape±¾Éí²»ÊÇʲôתÒå·û£¨¸Õ²ÅÎÒ¾ÍÊÇÔÚÕâÀï¸ã´íÁË£©£¬¶øÊǽ«escapeºóÃæµÄ·ûºÅ¶¨ÒåΪתÒå·û¡£¾Ù¸öÀý£º select ......
--½áºÏsys.indexesºÍsys.index_columns,sys.objects,sys.columns²éѯË÷ÒýËùÊôµÄ±í»òÊÓͼµÄÐÅÏ¢
select
o.name as ±íÃû,
i.name as Ë÷ÒýÃû,
c.name as ÁÐÃû,
i.type_desc as ÀàÐÍÃèÊö,
is_primary_key as Ö÷¼üÔ¼Êø,
is_unique_constraint as Î¨Ò»Ô¼Êø,
is_disable ......
±¾ÎĽéÉÜÁËSQL Server 2008ÀïһЩеÄÌØµãÒÔ¼°·¢ÏÖµÄһЩ¾«ÃîÖ®´¦……
¡¡¡¡°²×°
¡¡¡¡SQL
Server
2008µÄÉèÖúͰ²×°Ò²ÓÐËù¸Ä½ø¡£ÅäÖÃÊý¾ÝºÍÒýÇæÎ»ÒѾ·Ö¿ªÁË£¬ËùÒÔËüʹ´´½¨»ù±¾µÄδÅäÖÃϵͳµÄ´ÅÅÌͼÏñ±äµÃ¿ÉÄÜÁË£¬Ëüʹ·Ö²¼µ½¶à¸ö·þÎñÆ÷±äµÃ¸üÈÝÒ×ÁË¡£
´Ó΢ÈíµÄÕ¾µãÒ²¿ÉÒÔÕÒµ½°²×°¿ÉÓõÄ×îиüС£ÁíÒ»¸öÌØµ ......
Microsoft SQL Server
2008ºÍMicrosoftÊý¾Ýƽ̨Ϊ¿ª·¢ÈËÔ±ÌṩÁËÒ»¸ö×ۺϵıà³Ì¼Ü¹¹£¬ÓÃÓÚ´´½¨Õë¶ÔÒÆ¶¯É豸¡¢×ÀÃæµçÄÔ¡¢Web·þÎñÆ÷£¬ºÍÆóÒµ·þÎñÆ÷µÄ»ùÓÚÊý¾ÝµÄ½â
¾ö·½°¸¡£Õâ¸öÊý¾Ý±à³Ì»·¾³½«Êý¾Ý·ÃÎʺ͹ÜÀí¼¯³Éµ½Ò»¸öÓ¦ÓóÌÐòµÄÒµÎñÂß¼ÖУ¬´Ó¶øÌá¸ßÁË¿ª·¢ÈËÔ±µÄÉú²úÁ¦¡£ËüÌṩÁËÒ»¸öÓÃÓÚ¶ÔÒì¹¹Êý¾ÝÔ´µÄÊý¾Ý·ÃÎʺ͹ÜÀí
µÄ ......
¡¾ÒýÓãºÃÍáï¼¼ÊõÎÄÕÂÕªÒª
¡¿
¾²âÊÔ£¬·½·¨¶þ¿É³É¹¦É¾³ýÊý¾Ý£¬·½·¨Ò»¡¢Èý ɾ³ýÊý¾Ýʧ°Ü¡£Çë·¹ýµÄÅóÓÑ£¬Ö¸µãÃÔ½ò¡£¡£¡£
ÎÊÌ⣺һ¸ö±íÓÐ×ÔÔöµÄID
ÁУ¬±íÖÐÓÐһЩ¼Ç¼ÄÚÈÝÖØ¸´£¬Ò²¾ÍÊÇ˵ÕâЩ¼Ç¼³ýÁËID
²»Í¬Ö®Í⣬ÆäËûµÄÐÅÏ¢¶¼Ïàͬ¡£ÐèÒª°ÑÖØ¸´µÄ¼Ç¼±£ÁôÒ»Ìõ£¬Ê£ÏµÄɾ³ý
·½·¨Ò»£º»¹ÊÇ2000
ÄêµÄʱºòһλOracl ......