Bala's Development Blog

.Net,SQL Server, ASP.Net ……

Archive for July, 2009

Get list of view that uses certain column name

without comments

Disclaimer : This tutorial is meant for beginners and for anyone who find it useful. The main purpose of this post to keep everything i find useful for future reference for myself and for others.

I was looking a query that tell me a list of view using certain view from a table, and found the answer here.

See the code below. Hope this could help someone somewhere.

select view_name from INFORMATION_SCHEMA.VIEW_COLUMN_USAGE
 where column_name='ColumnNameHere'
 and table_name='TableNameHere'

Written by BALA SINGAM

July 19th, 2009 at 9:36 pm

Posted in SQL server Basics

Tagged with , , ,

How to shrink db log file

without comments

I got this code snippet from my collegue , hope this can be helpful for others too

declare @dbname nvarchar(255)
set @dbname = 'databasename'
backup log @dbname with truncate_only
DBCC SHRINKDATABASE (@dbname, 0)

Written by BALA SINGAM

July 18th, 2009 at 9:32 pm