SQL SERVERÊý¾Ý¿âÖÐµÄ±í±¸·Ý³ÉÎı¾
--×÷ÓãºÊý¾Ý¿âÖÐµÄ±í±¸·Ý³ÉÎı¾
Declare @tabname varchar(200),@ip varchar(50),@user varchar(50),@password varchar(50),@sql varchar(1000),@filetxt varchar(200),@file varchar(50)
set @tabname='database.dbo.tb' --±íÃû
set @ip='127.0.0.1' --IPµØÖ·£¬±¾»úµÄ»°¾Íд127.0.0.1
set @user='sa' --Êý¾Ý¿âÓû§Ãû
set @password='123' --Êý¾Ý¿âÃÜÂë
set @file='c:\' --±¸·Ý·¾¶
set @filetxt='tb.txt' --±¸·ÝÎļþÃû
set @sql='Bcp '+@tabname+' out '+@file+@filetxt+' -S '+@ip+' -U '+@user+' -P '+@password+' -t \t -c'
Print @sql
Exec master..xp_cmdshell @sql,No_Output
Ïà¹ØÎĵµ£º
SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓ㨶þ£©
×÷Õߣºfreedk
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¸ÄÉÆSQLÓï¾ä
¡¡¡¡ºÜ¶àÈ˲»ÖªµÀSQLÓï¾äÔÚSQL SERVERÖÐÊÇÈçºÎÖ´Ðеģ¬ËûÃǵ£ÐÄ×Ô¼ºËùдµÄSQLÓï¾ä»á±»SQL SERVERÎó½â¡£±ÈÈ磺
select * from table1 where name=''zhangsan'' and tID > 10000
ºÍÖ´ÐÐ:
select * from table1 where tID > ......
SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓã¨Èý£©
×÷Õߣºfreedk
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¶þ¡¢¸ÄÉÆSQLÓï¾ä
ʵÏÖСÊý¾ÝÁ¿ºÍº£Á¿Êý¾ÝµÄͨÓ÷ÖÒ³ÏÔʾ´æ´¢¹ý³Ì
¡¡¡¡½¨Á¢Ò»¸ö Web Ó¦Ó㬷ÖÒ³ä¯ÀÀ¹¦Äܱز»¿ÉÉÙ¡£Õâ¸öÎÊÌâÊÇÊý¾Ý¿â´¦ÀíÖÐÊ®·Ö³£¼ûµÄÎÊÌâ¡£¾µäµÄÊý¾Ý·ÖÒ³·½·¨ÊÇ:ADO ¼Í¼¼¯·ÖÒ³·¨£¬Ò²¾ÍÊÇÀûÓÃADO×Ô´øµÄ·ÖÒ³¹¦ÄÜ£¨ÀûÓÃÓα꣩À ......
1. ²é¿´Êý¾Ý¿âµÄ°æ±¾
¡¡¡¡ select @@version
¡¡¡¡2. ²é¿´Êý¾Ý¿âËùÔÚ»úÆ÷²Ù×÷ϵͳ²ÎÊý
¡¡¡¡exec master..xp_msver
¡¡¡¡3. ²é¿´Êý¾Ý¿âÆô¶¯µÄ²ÎÊý
¡¡¡¡sp_configure
¡¡¡¡4 ......
sysaltfiles Ö÷Êý¾Ý¿â ±£´æÊý¾Ý¿âµÄÎļþ
syscharsets Ö÷Êý¾Ý¿â &nb ......
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¶¼ÊÇÈÕÆÚÀàÐ͵Ä× ......