Tuesday, April 29, 2008

Tips & Tricks

Hey friends,

This post I have made to provide tips about SQL server. Most of you will find this as a very basic kind of tips but as I want to share my experience, so will say that knowing this information about SQL server was also very helpful.

1) How to get Comma Separated value from one database field (like 'surjit', 'harjit', 'ramu', 'fakirchand')?

In stored procedure use the following:
Declare @commaVar as varchar(4000)
Select @commaVar = IsNull(@CommaVar +',','') + convert(varchar,) from

/* That's it friends----don't write this in Stored procedure :)*/

2) How to reduce LogFile size when error is coming to truncate size?
Most of time, need arises to truncate the size of database log file. Use the following to make it work:


That's it. Enjoy.

1 comment:

shivani said...

Thanks :) its very much help full...