Êý¾ÝÀàÐÍÊÇÊý¾ÝµÄÒ»ÖÖÊôÐÔ£¬±íʾÊý¾ÝËù±íʾÐÅÏ¢µÄÀàÐÍ¡£ÈκÎÒ»ÖÖ¼ÆËã»úÓïÑÔ¶¼¶¨ÒåÁË×Ô¼ºµÄÊý¾ÝÀàÐÍ¡£µ±È»£¬²»Í¬µÄ³ÌÐòÓïÑÔ¶¼¾ßÓв»Í¬µÄÌص㣬Ëù¶¨ÒåµÄÊý¾ÝÀàÐ͵ĸ÷ÀàºÍÃû³Æ¶¼»ò¶à»òÉÙÓÐЩ²»Í¬¡£SQLServerÌṩÁË25ÖÖÊý¾ÝÀàÐÍ£º
¡¡¡¡·Binary[(n)]
¡¡¡¡·Varbinary[(n)]
¡¡¡¡·Char[(n)]
¡¡¡¡·Varchar[(n)]
¡¡¡¡·Nchar[(n)]
¡¡¡¡·Nvarchar[(n)]
¡¡¡¡·Datetime
¡¡¡¡·Smalldatetime
¡¡¡¡·Decimal[(p[,s])]
¡¡¡¡·Numeric[(p[,s])]
¡¡¡¡·Float[(n)]
¡¡¡¡·Real
¡¡¡¡·Int
¡¡¡¡·Smallint
¡¡¡¡·Tinyint
¡¡¡¡·Money
¡¡¡¡·Smallmoney
¡¡¡¡·Bit
¡¡¡¡·Cursor
¡¡¡¡·Sysname
¡¡¡¡·Timestamp
¡¡¡¡·Uniqueidentifier
¡¡¡¡·Text
¡¡¡¡·Image
¡¡¡¡·Ntext
(1)¶þ½øÖÆÊý¾ÝÀàÐÍ
¡¡¡¡¶þ½øÖÆÊý¾Ý°üÀ¨Binary¡¢VarbinaryºÍImage
¡¡¡¡BinaryÊý¾ÝÀàÐͼȿÉÒÔÊǹ̶¨³¤¶ÈµÄ(Binary),Ò²¿ÉÒÔÊDZ䳤¶ÈµÄ¡£
¡¡¡¡Binary[(n)]ÊÇnλ¹Ì¶¨µÄ¶þ½øÖÆÊý¾Ý¡£ÆäÖУ¬nµÄÈ¡Öµ·¶Î§ÊÇ´Ó1µ½8000¡£Æä´æ´¢ñ¿µÄ´óСÊÇn+4 ......
MSSQL¾µäÓï¾ä
1.°´ÐÕÊϱʻÅÅÐò:Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.Êý¾Ý¿â¼ÓÃÜ:select encrypt('ÔʼÃÜÂë')
select pwdencrypt('ÔʼÃÜÂë')
select pwdcompare('ÔʼÃÜÂë','¼ÓÃܺóÃÜÂë') = 1--Ïàͬ£»·ñÔò²»Ïàͬ encrypt('ÔʼÃÜÂë')
select pwdencrypt('ÔʼÃÜÂë')
select pwdcompare('ÔʼÃÜÂë','¼ÓÃܺóÃÜÂë') = 1--Ïàͬ£»·ñÔò²»Ïàͬ
3.È¡»Ø±íÖÐ×Ö¶Î:declare @list varchar(1000),@sql nvarchar(1000)
select @list=@list+','+b.name from sysobjects a,syscolumns b where a.id=b.id and a.name='±íA'
set @sql='select '+right(@list,len(@list)-1)+' from ±íA'
exec (@sql)
4.²é¿´Ó²ÅÌ·ÖÇø:EXEC master..xp_fixeddrives
5.±È½ÏA,B±íÊÇ·ñÏàµÈ:if (select checksum_agg(binary_checksum(*)) from A)
=
(select checksum_agg(binary_checksum(*)) from B)
print 'ÏàµÈ'
else
print '²»ÏàµÈ'
6.ɱµôËùÓеÄʼþ̽²ìÆ÷½ø³Ì:DECLARE hcforeach CURSOR GLOBAL FOR SELECT 'kill '+RTRIM(spid) from master.dbo.sysprocesses
WHERE program_name IN('SQL profiler',N'SQL ʼþ̽²éÆ÷')
EXEC sp_msforeac ......
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4¡¢ËµÃ÷£º´´½¨Ð±í
create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)
¸ù¾ÝÒÑÓÐµÄ±í´´½¨ÐÂ±í£º
A£ºcreate table tab_new like tab_old (ʹÓÃ¾É±í´´½¨Ð±í)
B£ºcreate table tab_new as select col1,col2… from tab_old definition only
5¡¢ËµÃ÷£ºÉ¾³ýбídrop table tabname
6¡¢ËµÃ÷£ºÔö¼ÓÒ»¸öÁÐ
Alter table tabname add column col type
×¢£ºÁÐÔö¼Óºó½«²»ÄÜɾ³ý¡£DB2ÖÐÁмÓÉϺóÊý¾ÝÀàÐÍÒ²²»Äܸı䣬ΨһÄܸıäµÄÊÇÔö¼Óv ......
ÖÆ×÷ÁËÒ»¸öDTS°ü£¬Äܹ»¿ª·¢»·¾³»òÕßÃüÁîÐÐÏÂÕýÈ·µÄÖ´ÐУ¬µ«ÔÚͨ¹ýAgent À´Ö´ÐеÄʱºò×ÜÊDZ¨´í£º
DTSRun: Loading... DTSRun: Executing... DTSRun OnStart: Copy Data from PRODFILE to [CompanyXYZDB].[dbo].[PRODFILE] Step DTSRun OnError: Copy Data from PRODFILE to [CompanyXYZDB].[dbo].[PRODFILE] Step, Error = -2147467259 (80004005) Error string: Error opening datafile: Access is denied. Error source: Microsoft Data Transformation Services Flat File Rowset Provider Help file: DTSFFile.hlp Help context: 0 Error Detail Records: Error: 5 (5); Provider Error: 5 (5) Error string: Error opening datafile: Access is denied. Error source: Microsoft Data Transformation Services Flat File Rowset Provider Help file: DTSFFile.hlp Help context: 0 DTSRun OnFinish: Copy Data from PRODFILE to [CompanyXYZDB].[dbo].[PRODFILE] Step DTSRun: Package execution complete. Process Exit Code 1. The step failed.
»òÕßÊÇÈçÏ´íÎó£º
´íÎóÔ´: Microsoft OLE DB Provider for Oracle ° ......
1¡¢Ã¿ÈÕ×Ô¶¯±¸·Ý
¡¡¡¡´ò¿ªÆóÒµ¹ÜÀíÆ÷£¬½øÈ듹ÜÀí”-“Êý¾Ý¿âά»¤¼Æ»®”£¬ÔÚÓҲര¿Úµã»÷ÓÒ¼ü£¬Ñ¡Ôñ“н¨Î¬»¤¼Æ»®”£¬Æô¶¯“Êý¾Ý¿âά»¤¼Æ»®Ïòµ¼”;µã»÷“ÏÂÒ»²½” Ñ¡ÔñÐèҪά»¤µÄÊý¾Ý¿â£¬Î¬»¤ÌØÐÔÊý¾Ý¿âʱ£¬Ñ¡Ôñ×îºóÒ»¸öµ¥Ñ¡¿ò²¢¹´Ñ¡ÐèҪά»¤µÄÊý¾Ý¿âÃû³Æ;“ÏÂÒ»²½”Ñ¡Ôñ¸üÐÂÊý¾ÝÓÅ»¯ÐÅÏ¢¡¢“ÏÂÒ»²½”¼ì²éÊý¾Ý¿âÍêÕû ÐÔ¡¢“ÏÂÒ»²½”Ö¸¶¨Êý¾Ý¿â±¸·Ý¼Æ»®¡¢“ÏÂÒ»²½”Ö¸¶¨±¸·Ý´æ·ÅλÖᢓÏÂÒ»²½”Ö¸¶¨ÊÂÎñÈÕÖ¾±¸·Ý¼Æ»®¡¢“ÏÂÒ»²½”Ö¸¶¨±¨±í£¬“ÏÂÒ»²½”Ö¸¶¨ÀúÊ·¼Í¼ά»¤£¬×î ºóÉ趨ά»¤×÷ÒµÃû³Æ;ͨ³£À´Ëµ£¬Èç¹ûÖ»ÐèÒª±¸·ÝÊý¾Ý¿âÎļþ£¬ÔòÖ»ÐèÒªÖ¸¶¨±¸·Ý¼Æ»®ÒÔ¼°´æ·ÅλÖü´¿É£¬ÆäËûÏîÄ¿²»×ö¸Ä¶¯¡£
¡¡¡¡ÔÚÖ¸¶¨±¸·Ý¼Æ»®Ê±ºò£¬ÓÉÓÚÐèҪÿÈÕ±¸·Ý£¬Òò´ËÒª¸ü¸Äµ÷¶È¡£µã»÷“¸ü¸Ä”±à¼µ÷¶È¡£·¢ÉúƵÂÊÑ¡ÔñÿÌì;ÿÈÕƵÂÊÑ¡Ôñ×÷Òµ¿ªÊ¼Ê±¼ä£¬×îºÃÑ¡ÔñÊý¾Ý¿â·ÃÎÊÁ¿Ð¡Ê±½øÐУ¬¶àΪ°ëҹʱ¼ä£¬¿É¸ù¾ÝÁ÷Á¿Í¼È·¶¨¾ßÌåʱ¼ä;³ÖÐøʱ¼äͨ³£²»ÓÃ×ö¸Ä¶¯£¬¿ªÊ¼ÈÕÆÚΪ±à¼ÈÕÆÚ£¬ÎÞ½áÊøÈÕÆÚ¡£
¡¡¡¡±à¼ºÃÉÏÊöά»¤¼Æ»®ºó£¬»¹Òª×¢ÒâÏ sql server´úÀí·þÎñÊÇ·ñÆô¶¯ÁË£ ......
Õâ¶Îʱ¼ä¿´Á˹ØÓÚÔÚSQL server ÖÐͨ¹ýÈÕÖ¾ºÍʱ¼äµãÀ´»Ö¸´Êý¾Ý¡£Ò²¿´ÁËһЩÍøÉϵÄÀý×Ó£¬¿´ÈçºÎͨ¹ýÈÕÖ¾À´»Ö¸´Êý¾Ý¡£
Ç°ÌáÌõ¼þ£º
Êý¾Ý¿âµÄ¹ÊÕϻָ´¸ÄΪ·Ç¼òµ¥Ä£Ê½£¬È¥µô×Ô¶¯¹Ø±ÕºÍ×Ô¶¯ÊÕËõÁ½¸öÑ¡Ïî
Èç¹ûÊǼòµ¥Ä£Ê½£º ÀàËÆÏÂÃæµÄÓï¾ä²Ù×÷Êý¾Ý¾Í²»»á¼Ç¼µ½ÈÕÖ¾ÖУº select * into t from [±íÃû]
ÕâʱΪ±£Ö¤Êý¾ÝµÄÍêÕûÒª½«Êý¾Ý¿âµÄ»Ö¸´Ä£Ê½¸Ä³É“ÍêÕû”
²âÊÔ»·¾³£º
1£¬½¨Á¢Êý¾Ý¿âºÍ²âÊÔ±í
create database zp
create table [zping.com](
id int,
name varchar(20)
)
²åÈë²âÊÔÊý¾Ý£º
insert into [zping.com](id,name)
values(1,'zping.com1')
insert into [zping.com](id,name)
values(2,'zping.com2')
i ......