Inner Join in SQL Server

Tables are

a userbasic

b userlmits

c groupauthclass

— 2 Table Inner Join SQL Server —


select a.userid,a.groupid,a.username,a.branch, b.onlinedebit,b.offlinedebit
from dbo.userbasic a join dbo.userlimits b on a.userid=b.userid ;

— 3 Table Inner Join SQL Server —


select a.userid,a.groupid,c.classid,c.authority, b.onlinedebit,b.offlinedebit
from dbo.userbasic a join dbo.userlimits b on a.userid=b.userid
join dbo.groupauthclass c on c.groupid=a.groupid;

Advertisements

Truncate Log in Database Mirroring SQL Server 2008 2012

select log_reuse_wait_desc from sys.databases where name = ‘AdventureWorks’

If Output is “LOG_BACKUP”

— Execute 2 Times just in case —

BACKUP LOG AdventureWorks TO DISK=’NUL:’

— Now Truncate the Log —

USE AdventureWorks
GO
ALTER DATABASE AdventureWorksSET RECOVERY SIMPLE WITH NO_WAIT;
GO
DBCC SHRINKFILE(AdventureWorks_LOG, 100);
GO
ALTER DATABASE AdventureWorks SET RECOVERY FULL WITH NO_WAIT;
GO