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

SQL Server SQLÓï¾äµ¼Èëµ¼³ö´óÈ«

/*******  µ¼³öµ½excel
EXEC master..xp_cmdshell ’bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"GNETDATA/GNETDATA" -U"sa" -P""’
/***********  µ¼ÈëExcel
SELECT *
from OpenDataSource( ’Microsoft.Jet.OLEDB.4.0’,
  ’Data Source="c:\test.xls";User ID=Admin;Password=;Extended properties=Excel 5.0’)...xactions
SELECT cast(cast(¿ÆÄ¿±àºÅ as numeric(10,2)) as nvarchar(255))+’¡¡’ ת»»ºóµÄ±ðÃû
from OpenDataSource( ’Microsoft.Jet.OLEDB.4.0’,
  ’Data Source="c:\test.xls";User ID=Admin;Password=;Extended properties=Excel 5.0’)...xactions
/** µ¼ÈëÎı¾Îļþ
EXEC master..xp_cmdshell ’bcp "dbname..tablename" in c:\DT.txt -c -Sservername -Usa -Ppassword’
/** µ¼³öÎı¾Îļþ
EXEC master..xp_cmdshell ’bcp "dbname..tablename" out c:\DT.txt -c -Sservername -Usa -Ppassword’
»ò
EXEC master..xp_cmdshell ’bcp "Select * from dbname..tablename" queryout c:\DT.txt -c -Sservername -Usa -Ppassword’
µ¼³öµ½TXTÎı¾£¬ÓöººÅ·Ö¿ª
exec master..xp_cmdshell ’bcp "¿âÃû..±íÃû" out "d:\tt.txt" -c -t ,-U sa -P password’
BULK INSERT ¿âÃû..±íÃû
from ’c:\test.txt’
WITH (
    FIELDTERMINATOR = ’;’,
    ROWTERMINATOR = ’\n’
)
--/* dBase IVÎļþ
select * from
OPENROWSET(’MICROSOFT.JET.OLEDB.4.0’
,’dBase IV;HDR=NO;IMEX=2;DATABASE=C:\’,’select * from [¿Í»§×ÊÁÏ4.dbf]’)
--*/
--/* dBase IIIÎļþ
select * from
OPENROWSET(’MICROSOFT.JET.OLEDB.4.0’
,’dBase III;HDR=NO;IMEX=2;DATABASE=C:\’,’select * from [¿Í»§×ÊÁÏ3.dbf]’)
--*/
--/* FoxPro Êý¾Ý¿â
select * from openrowset(’MSDASQL’,
’Driver=Microsoft Visual FoxPro Driver;SourceType=DBF;SourceDB=c:\’,
’select * from [aa.DBF]’)
--*/
/**************µ¼ÈëDBFÎļþ****************/
select * from openrowse


Ïà¹ØÎĵµ£º

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

1¡¢ÎļþºÍÎļþ×éµÄº¬ÒåÓë¹Øϵ
ÿ¸öÊý¾Ý¿âÓÐÒ»¸öÖ÷Êý¾ÝÎļþ.ºÍÈô¸É¸ö´ÓÎļþ¡£ÎļþÊÇÊý¾Ý¿âµÄÎïÀíÌåÏÖ¡£ Îļþ×é¿ÉÒÔ°üÀ¨·Ö²¼ÔÚ¶à¸öÂß¼­·ÖÇøµÄÎļþ£¬ÊµÏÖ¸ºÔØƽºâ¡£Îļþ×éÔÊÐí¶ÔÎļþ½øÐзÖ×飬ÒÔ±ãÓÚ¹ÜÀíºÍÊý¾ÝµÄ·ÖÅ䣯·ÅÖá£ÀýÈ磬¿ÉÒÔ·Ö±ðÔÚÈý¸öÓ²ÅÌÇý¶¯Æ÷ÉÏ´´½¨Èý¸öÎļþ£¨Data1.ndf¡¢Data2.ndf ºÍ Data3.ndf£©£¬²¢½«ÕâÈý¸ ......

ºØÖÝÊм²²¡Ô¤·À¿ØÖÆÖÐÐÄSQL serverÊý¾Ý¿âÖÃÒɳɹ¦ÐÞ¸´

ºØÖÝÊм²²¡Ô¤·À¿ØÖÆÖÐÐÄËùÓõÄZmSoft´ÓÒµÌå¼ìÐÅÏ¢ÍøÂçϵͳV2010.1.26 Õýʽ°æ²ÉÓÃSQL SERVER2000ƽ̨,²»Ã÷Ô­Òò,Êý¾Ý¿â"ÖÃÒÉ“,¿Í»§ÊÔ¹ýËùÓÐÍøÉÏ·½·¨,δÄܽâ¾ö.ÉòÑô¿­ÎÄÊý¾Ý»Ö¸´ÖÐÐÄSQLÊý¾Ý¿â¹¤³Ìʦ³É¹¦½«Æä½â¾ö.
ÉòÑô¿­ÎÄÊý¾Ý»Ö¸´ÖÐÐÄMS SQL SERVERÑз¢Ð¡×éÖÂÁ¦ÓÚMsSqlÊý¾Ý¿â¼¼ÊõµÄÑо¿¡£¾­¹ý¶àÄêÑо¿ÍêÈ«ÕÆÎÕÁËS ......

ÓαêÊôÐÔSQL%FOUND,SQL%NOTFOUND,SQL%ROWCOUNT

¡¡¡¡µ±Ö´ÐÐÒ»ÌõDMLÓï¾äºó£¬DMLÓï¾äµÄ½á¹û±£´æÔÚËĸöÓαêÊôÐÔÖУ¬ÕâЩÊôÐÔÓÃÓÚ¿ØÖƳÌÐòÁ÷³Ì»òÕßÁ˽â³ÌÐòµÄ״̬¡£µ±ÔËÐÐDMLÓï¾äʱ£¬PL/SQL´ò¿ªÒ»¸öÄÚ½¨Óα겢´¦Àí½á¹û£¬ÓαêÊÇά»¤²éѯ½á¹ûµÄÄÚ´æÖеÄÒ»¸öÇøÓò£¬ÓαêÔÚÔËÐÐDMLÓï¾äʱ´ò¿ª£¬Íê³Éºó¹Ø±Õ¡£ÒþʽÓαêֻʹÓÃSQL%FOUND,SQL%NOTFOUND,SQL%ROWCOUNTÈý¸öÊôÐÔ.SQL%FOUND,SQ ......

MS SQL 2000/2005 Ð޸ıíËùÓÐÕß´æ´¢¹ý³Ì

Create PROCEDURE [dbo].[ChangeObjectOwner]
@OldOwner as NVARCHAR(128),
@NewOwner as NVARCHAR(128)
AS
DECLARE @Name   as NVARCHAR(128)
DECLARE @Owner  as NVARCHAR(128)
DECLARE @OwnerName as NVARCHAR(128)
DECLARE curObject CURSOR FOR
select 'Name' = name,
 'Owner'&n ......

±ê×¼µÄ SQL µÄ½âÎö˳Ðò

±ê×¼µÄ SQL µÄ½âÎö˳ÐòΪ:
(
1
).
from
×Ó¾ä, ×é×°À´×Ô²»Í¬Êý¾ÝÔ´µÄÊý¾Ý
(
2
).
WHERE
×Ó¾ä, »ùÓÚÖ¸¶¨µÄÌõ¼þ¶Ô¼Ç¼½øÐÐɸѡ
(
3
).
GROUP

BY
×Ó¾ä, ½«Êý¾Ý»®·ÖΪ¶à¸ö·Ö×é
(
4
).ʹÓþۺϺ¯Êý½øÐмÆËã
(
5
).ʹÓÃ
HAVING
×Ó¾äɸѡ·Ö×é
(
6
).¼ÆËãËùÓеıí´ïʽ
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ