Monthly Archives: April 2015 - Page 4

How to move system Databases – TEMPDB

first fire sp_helpfile to get the name and location of the files

use master
GO
sp_helpfile

ALTER DATABASE TEMPDB MODIFY FILE (
NAME = tempdev, FILENAME = 'E:\TEMPDB\tempdev.mdf'
)
ALTER DATABASE TEMPDB MODIFY FILE (
NAME = templog, FILENAME = 'E:\TEMPDB\templog.ldf'
)

It will only be reflected after SQL Server is restarted. Then you can delete those old tempdev.mdf and templod.ldf files to gain space.

MERGE statement in SQL

It comes with 3 flavours:

    when matched – update or delete
    when not matched – insert – present in source NOT in target
    when not matched by source – present in target NOT in source, you can then update or delete

efficient than individual insert or delete

Interesting usage of PARSENAME() in SQL

— Limitation of only 3 DOTS or 4 max value
select parsename('my.name.is.admin', 4)
select parsename('my.name.is.admin', 3)
select parsename('my.name.is.admin', 2)
select parsename('my.name.is.admin', 1)

My Transaction Log is bloated…what do I do?

first take log backup
then it truncates tlog but the size wouldnt change
so then shrink the log file now

DBCC SHRINKFILE(pubs_log, 1)

Take recurrent full backups and all uncommitted transactions will be flushed out

Is SSIS Cluster aware?

SSIS services by default cannot handle named instances
SSIS also is not cluster-aware and is single instance application (i.e. only one copy of SSIS can run on server at a time).