Sql 2000 Êý¾Ý¿â±¸·ÝʵÀý
Êý¾Ý¿â±¸·ÝʵÀý/**
**Êý¾Ý¿â±¸·ÝʵÀý
**Öì¶þ 2004Äê5ÔÂ
**±¸·Ý²ßÂÔ:
**Êý¾Ý¿âÃû:test
**±¸·ÝÎļþµÄ·¾¶e:\backup
**ÿ¸öÐÇÆÚÌìÁ賿1µã×öÒ»´ÎÍêÈ«±¸·Ý,Ϊ±£ÏÕÆð¼û,±¸·Ýµ½Á½¸öͬÑùµÄÍêÈ«±¸·ÝÎļþtest_full_A.bakºÍtest_full_B.bak
**ÿÌì1µã(³ýÁËÐÇÆÚÌì)×öÒ»´Î²îÒ챸·Ý,·Ö±ð±¸·Ýµ½Á½¸öÎļþtest_df_A.bakºÍtest_df_B.bak(²ÉÓø½¼Óµ½Ô±¸·ÝµÄ·½Ê½)
**ÿһ¸öСʱ×öÒ»´ÎÊÂÎñÈÕÖ¾±¸·Ý,·Ö±ð±¸·Ýµ½Á½¸öÎļþtest_log_A.bakºÍtest_log_B.bak(²ÉÓø½¼Óµ½Ô±¸·ÝµÄ·½Ê½)
**/
--µÚÒ» ÍêÈ«±¸·Ý²¿·Ö
--ÐÂÔö×÷Òµ
EXEC sp_add_job @job_name = 'ÍêÈ«±¸·Ý'
--ÐÂÔö×÷Òµ²½Öè1,°ÑÊý¾Ý¿â±¸·Ýµ½test_full_backup_A.bak
EXEC sp_add_jobstep @job_name = 'ÍêÈ«±¸·Ý',
@step_name = 'Setp1',
@subsystem = 'TSQL',
@command = 'BACKUP DATABASE Test TO DISK=''e:\backup\test_full_A.bak'' WITH INIT',
@on_fail_action=3, --ʧ°Üºóתµ½ÏÂÒ»²½
@on_success_action=3,-- ³É¹¦ºóתµ½ÏÂÒ»²½
@retry_attempts = 5,
@retry_interval = 5
--ÐÂÔö×÷Òµ²½Öè2,°ÑÊý¾Ý¿â±¸·Ýµ½test_full_B.bak
EXEC sp_add_jobstep @job_name = 'ÍêÈ«±¸·Ý',
@step_name = 'Setp2',
@subsystem = 'TSQL',
@command = 'BACKUP DATABASE Test TO DISK=''e:\backup\test_full_B.bak'' WITH INIT',
@retry_attempts = 5,
@retry_interval = 5
--µ÷¶È
EXEC sp_add_jobschedule @job_name = 'ÍêÈ«±¸·Ý',
@name = 'Schedule_1',
@freq_type = 8, -- °´ÖÜ
@freq_interval = 1, --ÿÐÇÆÚÌìÖ´ÐÐ
@freq_recurrence_factor=1,
&n
Ïà¹ØÎĵµ£º
ÈçºÎÔÚSQLÖÐÆôÓÃÈ«ÎļìË÷¹¦ÄÜ£¿
¡¡¡¡--------------------------------------------------------------------------------
¡¡¡¡È«ÎÄË÷ÒýµÄÒ»¸öÀý×Ó£¬ÔÚ²éѯ·ÖÎöÆ÷ÖÐʹÓãº
¡¡¡¡use pubs
¡¡¡¡go
¡¡¡¡--´ò¿ªÊý¾Ý¿âÈ«ÎÄË÷ÒýµÄÖ§³Ö
¡¡¡¡execute sp_fulltext_database 'enable'
¡¡¡¡go
¡¡¡¡--½¨Á¢È«ÎÄĿ¼ft_titles
¡¡¡ ......
ÔÚT-sqlµÄд·¨ÉÏÓкܴóµÄ½²¾¿£¬ÏÂÃæÁгö³£¼ûµÄÒªµã£ºÊ×ÏÈ£¬DBMS´¦Àí²éѯ¼Æ»®µÄ¹ý³ÌÊÇÕâÑùµÄ£º
1¡¢²éѯÓï¾äµÄ´Ê·¨¡¢Óï·¨¼ì²é
2¡¢½«Óï¾äÌá½»¸øDBMSµÄ²éѯÓÅ»¯Æ÷
3¡¢ÓÅ»¯Æ÷×ö´úÊýÓÅ»¯ºÍ´æȡ·¾¶µÄÓÅ»¯
4¡¢ÓÉÔ¤±àÒëÄ£¿éÉú³É²éѯ¹æ»®
5¡¢È»ºóÔÚºÏÊʵÄʱ¼äÌá½»¸øϵͳ´¦ÀíÖ´ÐÐ
6¡¢×îºó½«Ö´Ðнá¹û·µ»Ø¸øÓû§¡£
Æä´Î£¬¿´Ò»ÏÂS ......
-->Title:Generating test data
-->Author:wufeng4552
-->Date :2009-09-25 09:56:07
if object_id('tb')is not null drop table tb
go
create table tb(ID int,name text)
insert tb select 1,'test'
go
--·½·¨1
select sql_variant_property(ID,'BaseType') from tb
--·½·¨2
select object_name(ID)± ......
ÁгöTableAÖÐÓеĶøTableBÖÐûÓÐ, ÒÔ¼°BÖÐÓжøAÖÐûÓеļǼ£º
ÆäÖÐÁ½¸ö±íµÄ½á¹¹Ïàͬ£¬Ñ¡ÔñµÄKey¿ÉÒÔ¶à¸ö
Select Key from
( select * from TableA
Union select * from TableB
)
group by Key
having count(Key)=1
ÁгöTableAÖÐÓеĶøTableBÖÐûÓеļǼ£º
Select Key from
( (select * from TableA
Un ......