SQLÁ´½ÓÊý¾Ý¿â
Standard Security:
"Data Source=Aron1;Initial
Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;User
ID=sa;Password=asdasd;Trusted_Connection=False"
(both
connection strings produces the same result)
Trusted Connection:
"Data
Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(both connection strings produces the same result)
(use serverName\instanceName as Data Source to use
an specifik SQLServer instance)
Connect via an IP
address:
"Data Source=190.190.200.100,1433;Network
Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the
Data Source is the port to use (1433 is the default))
Enabling MARS (multiple active result sets):
"Server=Aron1;Database=pubs;Trusted_Connection=True;MultipleActiveResultSets=true"
Note! Use &nbs
Ïà¹ØÎĵµ£º
³£ÓÃSQL²éѯ£º
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
select tablespace_name, file_id, ......
Case¾ßÓÐÁ½ÖÖ¸ñʽ¡£¼òµ¥Caseº¯ÊýºÍCaseËÑË÷º¯Êý¡£
--¼òµ¥Caseº¯Êý
CASE sex
WHEN '1' THEN 'ÄÐ'
WHEN '2' THEN 'Å®'
ELSE 'ÆäËû' END
--CaseËÑË÷º¯Êý
CASE WHEN sex = '1' THEN 'ÄÐ'
&nbs ......
--¿ç·þÎñÆ÷²éѯÈçÏ£º
SELECT a.*,b.stor_Name
from OPENROWSET('MSDASQL',
'DRIVER={SQL Server};SERVER=tom;UID=sa;PWD=123',
pubs.dbo.authors) AS a,stores b
ORDER BY a.au_lname, a.au_fname
--ÆäÖУ¬tomΪԶ³Ì·þÎñÆ÷Ãû£¬stores ÊDZ¾»úÊý¾Ý¿âpubsÖеıí
--ÐèҪעÒâµÄÊÇÈô¶þ¸ö±íÖÐµÄ ......
1: ɾ³ýLOG (ɾ³ýlogÎļþ£¬¸½¼Óʱ×Ô¶¯Öؽ¨logÎļþ£¬ÒÔ´Ë·½Ê½À´Çå¿ÕÈÕÖ¾)
1) ·ÖÀëÊý¾Ý¿â ÆóÒµ¹ÜÀíÆ÷££¾·þÎñÆ÷££¾Êý¾Ý¿â££¾ÓÒ¼ü££¾·ÖÀëÊý¾Ý¿â
2) ɾ³ýLOGÎļþ
3) ¸½¼ÓÊý¾Ý¿â ÆóÒµ¹ÜÀíÆ÷££¾·þÎñÆ÷££¾Êý¾Ý¿â££¾ÓÒ¼ü££¾¸½¼ÓÊý¾Ý¿â
´Ë·¨Éú³ ......
use Tempdb
go
if object_ID ( 'fn_ACITEncryption' ) is not null
drop function fn_ACITEncryption
go
create function fn_ACITEncryption
(
@Str nvarchar ( 4000), -- ¼ÓÃܵÄ×Ö·û´®
@Flag bit = 1, --1 ¡¢¼ÓÃÜ 0 ¡¢½âÃÜ
@Key nvarchar ( 50) -- ÃÜÎÄ
)
returns nvarchar ( 4000) ......