Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Sql Server ×Ô動還Ô­½â決·½°¸

¸ù據ǰһƪ關ì¶×Ô動備·ÝµÄÎÄÕ£¬對應µÄ×Ô動還Ô­·½°¸
create procedure [dbo].[sp_RestoreDatabase]
@SourceDirBackupFiles NVARCHAR(200)
as
declare @DatabaseName sysname
--Table to hold the result from RESTORE HEADERONLY. Needed to get the database name out from
CREATE TABLE #bdev(
 BackupName NVARCHAR(128)
,BackupDescription NVARCHAR(255)
,BackupType smallint
,ExpirationDate datetime
,Compressed tinyint
,Position smallint
,DeviceType tinyint
,UserName NVARCHAR(128)
,ServerName NVARCHAR(128)
,DatabaseName NVARCHAR(128)
,DatabaseVersion INT
,DatabaseCreationDate datetime
,BackupSize numeric(20,0)
,FirstLSN numeric(25,0)
,LastLSN numeric(25,0)
,CheckpointLSN numeric(25,0)
,DatabaseBackupLSN numeric(25,0)
,BackupStartDate datetime
,BackupFinishDate datetime
,SortOrder smallint
,CodePage smallint
,UnicodeLocaleId INT
,UnicodeComparisonStyle INT
,CompatibilityLevel tinyint
,SoftwareVendorId INT
,SoftwareVersionMajor INT
,SoftwareVersionMinor INT
,SoftwareVersionBuild INT
,MachineName NVARCHAR(128)
,Flags INT
,BindingID uniqueidentifier
,RecoveryForkID uniqueidentifier
,Collation NVARCHAR(128)
,FamilyGUID uniqueidentifier
,HasBulkLoggedData INT
,IsSnapshot INT
,IsReadOnly INT
,IsSingleUser INT
,HasBackupChecksums INT
,IsDamaged INT
,BegibsLogChain INT
,HasIncompleteMetaData INT
,IsForceOffline INT
,IsCopyOnly INT
,FirstRecoveryForkID uniqueidentifier
,ForkPointLSN numeric(25,0)
,RecoveryModel NVARCHAR(128)
,DifferentialBaseLSN numeric(25,0)
,DifferentialBaseGUID uniqueidentifier
,BackupTypeDescription NVARCHAR(128)
,BackupSetGUID uniqueidentifier
)
TRUNCATE TABLE #bdev
INSERT #bdev
EXEC('RESTORE HEADERONLY from DISK = ''' + @SourceDirBackupFiles + '''')
--select * from #bdev
 
declare @position int  
declare @BackupType int
declare @last_log_position int
 
select @last_log_position=ma


Ïà¹ØÎĵµ£º

PL/SQL³õѧÕ߱ضÁ£º¼¸Ê®¸öʵÓõÄPL/SQL

µÚÒ»½×¶Î
Q.±àдһ¸öPL/SQL³ÌÐò¿éÒÔÏÔʾËù¸ø³ö¹ÍÔ±±àºÅµÄ¹ÍÔ±µÄÏêϸÐÅÏ¢¡£
A.
 DECLARE
 erec emp%ROWTYPE;
BEGIN
 SELECT * INTO erec from emp  WHERE empno=&¹ÍÔ±±àºÅ;
 DBMS_OUTPUT.PUT_LINE('EmpNo' || ' ' || 'Ename' || ' '|| 'Job' || ' ' || 'Manager' || ' ' || 'HireDate' ......

SQL ServerÖÐÁÙʱ±íÓë±í±äÁ¿µÄÇø±ð

ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾­³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã±íÏàËÆ£¬ ......

ms sql³£ÓÃÓï¾ä(¸ù¾ÝÐèÒªËæʱ¸üÐÂ)


²éѯÖظ´Öµ£¬ÏÔʾ³ö²»Öظ´µÄ²¿·Ö
select distinct(employeeid) from orders
²éѯÁ½¸ö±íÖ®¼äÏàͬÊý¾Ý
select orders.EmployeeID,Employees.EmployeeID
from orders  INNER JOIN Employees
on Employees.EmployeeID=orders.EmployeeID
ʵÏÖÄ¿µÄ£¬Ò»¸ö±í´æ·ÅÓû§±àºÅºÍÓû§Ãû£¬ÔÚÁíÒ»¸ö±íÖпÉÒÔ¸ù¾ÝÓû§±àº ......

ÈçºÎʶ±ð SQL Server µÄ°æ±¾¡¾×ª×Ômsdn¡¿

ÈçºÎÈ·¶¨ËùÔËÐÐµÄ SQL Server 2005 µÄ°æ±¾
Ҫȷ¶¨ËùÔËÐÐµÄ SQL Server 2005 µÄ°æ±¾£¬ÇëʹÓà SQL Server Management Studio Á¬½Óµ½ SQL Server 2005£¬È»ºóÔËÐÐÒÔÏ Transact-SQL Óï¾ä£º
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
ÔËÐнá¹ûÈçÏ£º
²úÆ·° ......

SQL ServerÓëExcelÊý¾Ý»¥µ¼

SQL ServerÓëExcelÊý¾Ý»¥µ¼
´ÓSQL ServerÖе¼Èë/µ¼³ö Excel µÄ»ù±¾·½·¨
/*=================== µ¼Èë/µ¼³ö Excel µÄ»ù±¾·½·¨ ===================*/
´ÓExcelÎļþÖÐ,µ¼ÈëÊý¾Ýµ½SQLÊý¾Ý¿âÖÐ,ºÜ¼òµ¥,Ö±½ÓÓÃÏÂÃæµÄÓï¾ä:
/*========================================================*/
--Èç¹û½ÓÊÜÊý¾Ýµ¼ÈëµÄ±íÒѾ­´æÔÚ
ins ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ