Friday, December 17, 2010

How to Setup Row-Level Security for SQL Server - Linked Article

Before I used to do it through several 'Views' and grant different permissions to each View, but recently I came across this good article by K. Brian Kelley....
How to Setup Row-Level Security for SQL Server

Friday, December 3, 2010

T-SQL Display Month Numbers and Names

SELECT Number + 1 as [Month Number],
DateName(mm,DATEADD(mm,Number,0)) as [Month Name]
FROM master..spt_values
WHERE Type = 'P' and Number < 12

Tuesday, November 9, 2010

SSIS Get date with the leading zeros

Hello,

Just a quick note on formatting SSIS date expression to display leading zeros for single digits days and months.

With refeence to this article ... http://codingstuffs.blogspot.com/2007/03/pgp-inside-ssis-package.html

The mentioned date variable can be done in a different way..

(DT_WSTR,4)YEAR(GETDATE()) +
SUBSTRING("0" +   (DT_STR, 2, 1252) DATEPART( "MM", GETDATE()) , LEN( "0" +   (DT_STR, 2, 1252) DATEPART( "MM", GETDATE()) ) - 1, 2 ) +
SUBSTRING("0" +   (DT_STR, 2, 1252) DATEPART( "DD", GETDATE()) , LEN( "0" +   (DT_STR, 2, 1252) DATEPART( "DD", GETDATE()) ) - 1, 2 )


or even using a smaller expression

Right( "0" + (DT_WSTR, 2 ) MONTH(Getdate()),2)  + "-" +
Right( "0" + (DT_WSTR, 2 ) DAY(Getdate()),2)  + "-" +
(DT_WSTR,4)YEAR(GETDATE())

Hope that helps.

Saturday, October 23, 2010

Save a copy as is not an option! Visual Studio 2008

Today while I was updating a SSIS package and was ready to upload it to the MSDB, I noticed that "Save a copy as" is not an option under the FILE menu, Referring to my earlier post: Server Explorer not showing up on Visual Studio 2008 , looks like the settings reset must have erased it.
the fix is to add it back on the menu!

Friday, September 17, 2010

ALBHABET in T-SQL

SELECT CHAR([number]) AS [ALBHABET]
FROM master..spt_values
WHERE number BETWEEN  65 and 90

Thursday, July 15, 2010