Sql Server Êý¾Ý¿âÁ¬½ÓÎÊÌâ
²Î¿¼ÎÄÏ×£ºhttp://www.cnblogs.com/chenxizhang/archive/2009/04/23/1441913.html
SQL ServerÌṩËÄÖÖ·½Ê½Á¬½ÓÊý¾Ý¿â·þÎñÆ÷:
1. share memory: Ö»ÊÊÓÃÓÚ¿Í»§¶ËºÍ·þÎñÆ÷¶ËÔÚͬһ̨»úÆ÷ÉÏ,²ÅÄܲÉÓõÄÁ¬½Ó
2. Named pipe:
ÔÚ¾ÖÓòÍø(LAN)ÄÚʵÏÖÁ¬½Ó,Ò»¸ö½ø³ÌʹÓÃÒ»²¿·ÖµÄÄÚ´æÀ´Ïò½ø³ÌµÄÁíÒ»¶Ë´«µÝÏûÏ¢,Ò»¸ö½ø³ÌµÄÊä³öÊÇÁíÍâÒ»¸ö½ø³ÌµÄÊäÈë.
3. TCP/IP: ÒòÌØÍøÉÏʹÓÃ,¿ÉÒÔÓÃÓÚ²»Í¬µÄÓ²¼þÌåϵ½á¹¹ºÍ²Ù×÷ϵͳµÄ¼ÆËã»úÍøÂçÖ®¼ä½øÐÐͨÐÅ(¶Ë¿ÚºÅ)
4. VIA:ÐéÄâ½Ó¿ÚÊÊÅäÆ÷£¬ÓëÒ»ÖÖÌض¨Ó²¼þÒ»ÆðʹÓõÄרÃÅ»¯µÄÐÒ飬ÖÁ½ñûÓÐÓùý¡£¡£¡£¡£
µ±ÎÒÃÇʹÓÿͻ§¶ËÃüÁîÐй¤¾ßÈçsqlcmd.exe½øÐзÃÎÊʱ£¬²ÉÓÃÈçϵÄ˳Ðò½øÐнâÎö£º
Ê×ÏÈ£¬»áʹÓÃsqlcmd.exe ÃüÁîÐй¤¾ßÊäÈëµÄÁ¬½Ó×Ö·û´®ËùÃèÊöµÄÐÒé½øÐÐÁ¬½Ó
Æä´Î£¬Èç¹ûÔÚsqlcmd.exeÃüÁîÐÐûÓÐÃèÊöÓйصÄÐÒ飬Ôò²ì¿´¿Í»§¶ËÅäÖùÜÀíÆ÷Ïà¹ØµÄ±ðÃûÉèÖÃÖÐËùÃèÊöµÄÐÅÏ¢½øÐÐÁ¬½Ó
×îºó£¬Èç¹ûÔÚ±ðÃûÐÅÏ¢ÖÐûÓÐÌṩÏà¹ØµÄÉèÖÃÐÅÏ¢£¬Ôò»á¸ù¾Ý¿Í»§¶ËÉèÖõÄÐÒéµÄ˳Ðò£¬ÒÀ´Î³¢ÊÔÓë·þÎñÆ÷¶Ë½øÐÐÁ¬½Ó¡£
ÏÂÃæ½éÉÜÕâËÄÖÖ·½Ê½µÄÁ¬½ÓÃüÁ
ĬÈÏÇé¿öÏ£¬ÎÒÃÇÒ»°ãÓÃÈçÏÂÃüÁî½øÐÐÁ¬½Ó£º
sqlcmd -S HT-WINSERVER1 ----Á¬½ÓĬÈÏʵÀý
sqlcmd -S HT-WINServer1\mssql2k5 ----Á¬½Ó¸Ã·þÎñÆ÷ÉϵķÇĬÈÏʵÀý
sqlcmd -S 172.16.15.233
sqlcmd -S 172.16.15.233\mssql2k5
sqlcmd -S 172.16.15.233,1121 ----²ÉÓö˿ںŵÄÐÎÊƽøÐÐÁ¬½ÓÃüÃûʵÀý
sqlcmd -S 172.16.15.233,1433 ----²ÉÓö˿ںŵÄÐÎÊƽøÐÐĬÈÏʵÀý
sqlcmd -S HT-WINSERVER1,1121 ----²ÉÓö˿ںŵÄÐÎÊƽøÐÐÁ¬½ÓÌض¨µÄÃüÃûʵÀý
ͨ¹ýÖ¸¶¨ÐÒéµÄ·½Ê½½øÐÐÁ¬½Ó(ÏÂÃæÊäÈëIPµÄµØ·½¶¼¿ÉÒÔÓÉ·þÎñÆ÷Ãû´úÌæ)£º
sqlcmd -S tcp£º172.16.15.233\mssql2k5, 1121 ----²ÉÓÃtcp/ip·½Ê½Á¬½Ó
sqlcmd -S tcp:172.16.15.233,1121
sqlcmd -S np:\\172.16.15.233\pipe\sql\query
-----²ÉÓÃÃüÃû¹ÜµÀ·½Ê½Á¬½Ó
sqlcmd -S np:\\172.16.15.233\pipe\MSSQL$mssql2k5\sql\query
sqlcmd -S
lpc:\172.16.15.233\mssql2k5
-----²ÉÓù²ÏíÄڴ淽ʽÁ¬½Ó
sqlcmd -S via:<computer
name>,<port
num>,<NIC number>
----ʹÓÃVIA·½Ê½Á¬½Ó
ÔÚSQL ServerÁ¬½ÓµÄ¹ý³ÌÖУ¬ÓÐʱÎÒÃÇͨ²Å²ÉÓò»ÊäÈë¶Ë¿ÚºÅµÄ·½Ê½½øÐÐÁ¬½Ó£¬Õâʱ¾ÍÐèÒªÒ»¸ö·þÎñÊÇÆô¶¯µÄ£¬¼´SQL Server
Browser£º
ÔÀí£º
Æô¶¯Ò»¸ö SQL Server ʵÀýºó£¬Èç¹ûΪ
SQL Server ÆôÓÃÁË TCP/IP »ò VIA ÐÒ飬·þÎñÆ÷
Ïà¹ØÎĵµ£º
ALTER FUNCTION [dbo].[fun_tongji]()
RETURNS @t1 table (
yue int ,
money int
)
AS
begin
Declare @i int
set @i=1
-- declare @t1 table (
-- yue int ,
-- money int
-- )
while (@i<=12)&n ......
SQL Server Out Put Excel File
ÔÚ SQL ServerÖÐ, µ¼³öEXCEL Îļþ, Óõ½ bcp.exe
bcp µ¼³öµÄ±¾ÖÊÊÇ´¿Îı¾Îĵµ,
ÈôÊý¾Ýº¬ÓÐÖÐÎÄ,Çëµ¼³öµ½ÖÐÎÄ°æEXCEL,»òTXTÎĵµµÈ, ·ñÔòÂÒÂë....
ÓÃTXT ´ò¿ªÓ¢ÎÄ°æEXCEL,Ò²¿ÉÒÔ,
µ¼³ö Êý¾Ýµ½C:\authors.xls, ÈôÎļþ´æÔÚÔòÖØдÎļþ, ²»´æÔÚÔò´´½¨Îļþ
  ......
×Ö·ûÀàÐÍ
Char: ¶¨³¤·ÇUnicodeµÄ×Ö·ûÐÍÊý¾Ý£¬×î´ó³¤¶ÈΪ8000
Varchar:±ä³¤·ÇUnicodeµÄ×Ö·ûÐÍÊý¾Ý£¬×î´ó³¤¶ÈΪ8000
Text(varchar(max)):±ä³¤·ÇUnicodeµÄ×Ö·ûÐÍÊý¾Ý£¬×î´ó³¤¶ÈΪ2G
Nchar:¶¨³¤UnicodeµÄ×Ö·ûÐÍÊý¾Ý£¬×î´ó³¤¶ÈΪ8000
Nvarchar:±ä³¤UnicodeµÄ×Ö·ûÐÍÊý¾Ý£¬×î´ó³¤¶ÈΪ8000
Ntext(nvarchar(max)):± ......
ÈçºÎÔ¶³ÌÅжÏOracleÊý¾Ý¿âµÄ°²×°Æ½Ì¨
¡¡¡¡select * from v$version;
¡¡¡¡²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
¡¡¡¡select sum(bytes)/(1024*1024) as free_space,tablespace_name
¡¡¡¡from dba_free_space
¡¡¡¡group by tablespace_name;
¡¡¡¡SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES ......