Baskar B.V

SQL - BI Consultant

  Home  |   Contact  |   Syndication    |   Login
  23 Posts | 0 Stories | 21 Comments | 0 Trackbacks

News

Baskar

Archives

Blogs

SQL-BACKUPS

SQL-PERFORMANCE

SQL-SERVER

Thursday, February 04, 2010 #

 

Below are the some interesting t-sql enhancements in sql 2008 posted in the web...

http://www.sqlservercentral.com/articles/SQL+Server+2008/65539/

http://www.sqlservercentral.com/articles/SQL+Server+2008/67550/

http://www.sqlservercentral.com/articles/SQL+Server+2008/67787/

http://www.sqlservercentral.com/articles/SQL+Server+2008/67945/

http://www.sqlservercentral.com/articles/SQL+Server+2008/67946/

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, January 26, 2010 #

 

Below code is to retrieve column of values into one variable without using cursors.

declare

@col_list varchar(max)

set

@col_list = ''

select

@col_list = @col_list + col1 + ', '

from

(select column1 as col1 from table1 ) d order by col1

select

@col_list = left(@col_list, len(@col_list)-2)

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, May 14, 2009 #

Check this link for a great post on index defrag script

http://sqlfool.com/2009/03/automated-index-defrag-script/

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, May 12, 2009 #

After dropping a database you should backup "master" database because deleting database update master database. If not, then if you want to restore "master" at some point then it would have reference to the non-existing databases.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, February 26, 2009 #

The below query would help if want to convert short month string (e.g) Jan, Feb to full month string (e.g) January, February...

Assuming mth_shrt in table1 has value like Jan, Feb, Mar and after the execution of the below query the result would be

 

Result:

January

February

Hope this helps. Post your views on this.

select datename(month,convert(varchar(20),'01/'+ mth_shrt_nm + '/1900',121)) from table1
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati