sql ³£ÓÃ
¹«Ë¾×éÖ¯SQLˮƽ¿¼ÊÔ£¬¿´ÁËд½Ì²Ä£¬Ð´Á˵ã×ܽᷢÉÏÀ´¸ú´ó¼Ò·ÖÏí¡£
ÎÒ¹«Ë¾Ê¹ÓõÄÊÇSybase ASE12.5£¬ËùÒÔÏÂÃæµÄһЩÌØÐÔÊÇÕë¶ÔSybase ASEµÄ¡£
Ò»£ºSQL Bisic
1£ºSQL(Structured Quary Language)ÌØÐÔ£º
a£º±ê×¼»¯
b£º·Ç¹ý³Ì»¯µÄ
c£º¿ÉÓÅ»¯µÄ
d£ºÃæÏò¼¯ºÏ²Ù×÷µÄ
2£ºASEÖеÄÊý¾ÝÀàÐÍ
a£ºNumberic
b£ºCharacter
c£ºDate/Time
d£ºLobs
3: convert(varchar, textColumn),Èç¹û²»Ö¸¶¨varchar(n)nÄÇôĬÈÏÊÇ30
4£ºwhere ÔÚsqlÖеÄ×÷ÓÃ
a£º¹ýÂËÊý¾Ý
b£º×ö±íÁ¬½Ó(sql92ÒÔÇ°)
c£ºÑ¡ÔñË÷Òý
5£ºwhare ºÍ havingµÄÇø±ð
whereÓï¾ä°Ñ¹ýÂ˺õÄÊý¾Ý²åÈëµ½work tableÖÐ
havingÓï¾ä´Ówork tableÖжÔÊý¾Ý½øÐÐÔÚ¹ýÂËÒԵõ½×îºóµÄ½á¹û¡£
6£ºÒ»¸öselectÓï¾äµÄÖ´ÐÐ˳Ðò
a£ºfrom clause
b£ºwhere clause
c£ºgroup by clause
d£ºselect clause
e£ºhaving clause
f£ºorder by clause
7£ºUnion VS Union All
a£ºUnion »á°ÑÁ½¸ö½á¹û¼¯ÅÅÐò£¬²¢ÇÒ³ýÈ¥Öظ´µÄÔªËØ£¨Ð§ÂʲÇáÒײ»ÒªÓã©
b£ºUnion All½ö½öÊÇ°ÑÁ½¸ö½á¹û¼¯ºÏ²¢£¬Ã»ÓÐÅÅÐò£¬Ò²²»È¥³ýÖظ´ÔªËØ£¨Ð§Âʺã©
¶þ£ºË÷ÒýºÍ²éѯ²ÎÊý
1£ºASEÖÐÓÐÈýÖÖaccessÊý¾Ý·½Ê½
a£ºclustered Index
b£ºnonclustered Index
c£ºtable scan
2£ºCovered Query
Ò»¸öCovered Query ½ö½ö´ÓË÷ÒýÖеõ½Êý¾Ý£¬²»ÓÃȥɨÃèÊý¾Ý¿â±í£¬ÕâÊÇ×î¿ìµÄÊý¾Ý²éѯ·½Ê½¡£
ÏÞÖÆ1£ºÖ»ÄÜÔÚseleceÖÐÉúЧ
ÏÞÖÆ2£ºËùÓб»ÒýÓõÄÁбØÐëÔÚͬһ¸önonclustered indexÖÐ
3£ºfunctional index
ÔÚASE15.0ÒÔºó²Å±»Ö§³Ö£¬Ò²¾ÍÊÇ˵ÔÚASE15.0ÒÔÇ°µÄ°æ±¾£¬ÏÂÁÐÓï¾äÊǿɶ¨²»»áÓÃÉÏË÷ÒýµÄ
sql ´úÂë
select column1
from table1
where upper(column2) = 'IVANL'
4£ºÈçºÎ²é¿´Ö´Ðмƻ®
sql ´úÂë
set showplan on
go
your sql
go
set showplan off
go
5: ÈçºÎ²é¿´IO
sql ´úÂë
set statistics io on
set statistics time on
go
you sql
go
set statistics io off
set statistics time off
go
6£ºÊ¹ÓÃIndexµÄ½¨Òé
a£ºÊ¹ÓÃÄÇЩ¾³£ÔÚwhereÓï¾äÖÐʹÓõÄ×Ö¶Î×öindex
b
Ïà¹ØÎĵµ£º
SqlserverÕⶫÎ÷ûÉÙ¸úËû´ò½»µÀ,¸Õѧ¿ª·¢ÓïÑÔʱ¾ÍÒѾ¸úËû½Ó´¥ÁË,²»ÒªËµºÜ¾«Í¨,µ«¾ÍÓï·¨»¹ËãÊÇÊìϤ,µ«ÏÖÔÚ¿ªÊ¼Ð´C#,·¢ÏÖºÜC#¶àÁËÒ»ÖÖSqlServerµÄ²ÎÊý´«È뷽ʽ,ÒÔÍùÎÒÃdz£³£¶ÔÒª´«²ÎµÄSqlÓï¾ä¶¼ÊÇÖ±½Óͨ¹ýÆ´´ÕSqlÓï¾äµÄ·½Ê½À´ÊµÏÖ,µ«ÏÖÔÚC#ΪʲôҪרÃÅ×öÒ»¸öSql²ÎÊýµÄÀàÀ´ÊµÏÖÄØ,¾¹ý²éÕÒ²ÅÖªµÀ,ÕâÑù×öÊÇÓеÀÀíµÄ,Ò»Ê ......
SqlServer µÄÐÔÄÜ±È Access Ìá¸ßµÄ²»Ö¹Ò»µãÁË¡£
²»¹ý£¬¿ÆÑ´CMSµÄÃâ·Ñ°æ´øµÄÊÇ Access Êý¾Ý¿â¡£
ÓÐûÓа취ת³É mssql µÄÄØ£¿µ±È»¿ÉÒÔ
1, mssqlÖÐн¨Ò»ÕÅ±í£¬È»ºóµ¼Èë access ÀïÃæµÄ±íºÍÊý¾Ý.
Õâ¸öÍøÉÏÓз½·¨£¬²»¶à˵ÁË¡£
2, ÐÞ¸Ä conn.asp µ½ sql server °æ±¾£¬Õâ¸öÒ²¼òµ¥¡£
3, ä¯ÀÀÊý¾Ý£¬Ö±½Ó¾Í¿ÉÒÔ¿´ ......
ÎÒ˵µÄ²»¶¨Ìõ¼þÊÇÖ¸²éѯÌõ¼þµÄ¸öÊý²»¶¨¡£ÓÐʱһ¸ö£¬ÓÐʱÁ½¸ö£¬ÓÐʱºÃ¼¸¸ö¡£
Ê×ÏÈÎÒ·¢ÏÖ
select * from A where a='kkk' Óë
select * from A where a like 'kkk'
ÆäʵЧ¹ûÊÇÒ»Ñù£¬Ö»Òª like ºóÃæµÄ×Ö·û´®²»°üº¬Í¨Åä·û¡£ÕâÑùÒ»À´¾ÍºÜ·½±ãÁË¡£Æ©ÈçÓÐ
select * from A where a='KKK' and b='LLL'
ÓÐÁ½¸ö²éѯÌõ¼þ£¬ ......
BOOL StartServer()
{
if(FAILED(CoInitialize(NULL)))
{
AfxMessageBox(_T("Com³õʼ»¯Ê§°Ü"));
return FALSE;
}
_SQLServerPtr spSQLServer ......
´´½¨×÷Òµ£º
DECLARE @jobid uniqueidentifier, @jobname sysname
SET @jobname = N'×÷ÒµÃû³Æ'
IF EXISTS(SELECT * from msdb.dbo.sysjobs WHERE name=@jobname)
EXEC msdb.dbo.sp_delete_job @job_name=@jobname
EXEC msdb.dbo.sp_add_job
@job_name = @jobname,
@job_id = @jobid OUTPUT
--¶¨Òå×÷Òµ²½Öè
DECLARE ......