SUBSTRING in SSRS

by ebarcza 11/28/2011 11:43:00 AM
simple really... it's called the MID function in SSRS


MID(str as string, Start as int32, End as int32)


=Mid(Fields!CommodityType.Value, 2, Len(Fields!CommodityType.Value))

Tags: ,

SQL Server Reporting Services

NetGear ProSafe VPN Firewall FVS338 review

by rbellantoni 11/17/2011 3:53:00 AM

I'm going to start off by saying that if you plan on buying ANY NetGear switch with the purpose of using as a reliable VPN, DO NOT. NetGear no longer supports the VPN Client software used to connect to it via IPSec and it is instead using TheGreenBow Client IPSec software set. While the software is ok, the interface is cludgy and definitely designed with more tech savy people in mind and is not a good interface used for business purposes. In short, the NetGear switches and firewall's work ok unless you plan on using it for VPN purposes, there are many many other options out there that have better interfaces and more professional VPN setup.

 

If you choose to purchase it anyway, or have already purchased it, feel free to check out this blog post to help get it configured: http://www.dotnetdawgs.com/post/Netgear-PROSAFE-VPN-Client-Configuration.aspx


Tags:

SQL Server Trigger Columns Updated

by ebarcza 11/10/2011 7:00:00 AM
This handy dandy little function will return a table with all the columns that were updated in a trigger.
CREATE FUNCTION [dbo].[udf_GetUpdatedColumns]( 
@Tablename VARCHAR(100), @ColumnsUpdated VARBINARY(255) ) 
RETURNS TABLE 
AS 
RETURN 
    SELECT 
        COLUMN_NAME 
    FROM INFORMATION_SCHEMA.COLUMNS Field 
    WHERE 
        TABLE_NAME = @Tablename 
        AND sys.fn_IsBitSetInBitmask( @ColumnsUpdated,
            COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), 
            COLUMN_NAME, 'ColumnID')) <> 0

Usage is as follows:

ALTER trigger [dbo].[trg_InfoUpdate] on [dbo].[Info] for  update
as
print 'TRIGGAH'
DECLARE @ColumnsUpdated VARBINARY(1000) = COLUMNS_UPDATED()
SELECT * FROM dbo.udfDecodeBitmask('BankingInfo', @ColumnsUpdated)

Tags: , ,

SQL SERVER

Overriding AspNetSqlMembershipProvider in ASP.NET 4.0

by rbellantoni 11/8/2011 7:45:00 AM

If you are having as much trouble as I did figuring out where the hell all the web.config settings went after creating Users and Roles using the built in administration tools in .NET then read on!

It turns out, that in ASP.NET 4.0, they removed some of the "clutter" from the web.config since some web.configs were getting very large with configurations and developer added keys etc. So they moved it to a machine.Config file inside of the framework folder. What this means is that they took out all the standard settings in the web.config that are required to run a website so you don't have to see them anymore....HOWEVER, they ALSO moved the default membership provider settings as well. So what does this mean?  It means you can't just make a tweak to the default settings, you need to actually implement your OWN web.config provider as follows:

 <membership>
            <providers>
                <clear/>
                <!--<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" 
                 enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
 passwordAttemptWindow="10" applicationName="/"/>-->
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" 
connectionStringName="test" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="500" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
            </providers>
        </membership>
        <profile>
            <providers>
                <clear/>
                <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
            </providers>
            <properties>
                <add name="DisplayName"/>
            </properties>
        </profile>
        <roleManager enabled="true">
            <providers>
                <clear/>
                <add connectionStringName="test" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"/>
                <!--<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"/>-->
                <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider"/>
            </providers>
        </roleManager>

Now you can go ahead and change the settings as necessary.

Tags:

.NET | ASP.NET Enterprise Library | SQL SERVER

SQL Server Function to Get number of Days in month

by ebarcza 11/4/2011 10:12:00 AM
CREATE FUNCTION [dbo].[fn_GetDaysInMonth] ( @pDate    DATETIME )
RETURNS INT
AS
BEGIN
    RETURN CASE WHEN MONTH(@pDate) IN (1, 3, 5, 7, 8, 10, 12) THEN 31
                WHEN MONTH(@pDate) IN (4, 6, 9, 11) THEN 30
                ELSE CASE WHEN (YEAR(@pDate) % 4    = 0 AND
                                YEAR(@pDate) % 100 != 0) OR
                               (YEAR(@pDate) % 400  = 0)
                          THEN 29
                          ELSE 28
                     END
           END
 
END

Tags:

SQL SERVER

Using Visual SourceSafe 2005 with Visual Studio 2010

by rbellantoni 11/2/2011 4:28:00 AM

You may notice that when you attempt to add your solution to a source control in Visual Studio 2010, that it only shows a TFS server as a choice. Don’t be alarmed, however, just:

1. Go to Tools > Options.

2. Click Show all settings if not checked, then go to Source Control.

3. Go to Plug-in Selection, then change the dropdown to Microsoft Visual SourceSafe.

4. That’s it!

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  November 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in