Saturday, September 21, 2013

SQL Server 2012 Pre-Requisite Issue

Hi all!

On a Windows 8 environment where in you have VS 2010 installed and you want to add SQL Server 2012 to your list of software, install first VS 2010 SP1 to make changes to setup configurations.

Cheers!

Visual Studio 2008 Failed Install on WIndows 8

Solution:

Turn on .NET Framework 3.5 which is built-in Windows 8. Make sure windows updates is turned on also.

Cheers!

Wednesday, September 18, 2013

Change BIOS Boot Options for Acer Aspire V5-431P/471P

Useful Acer Tip: Change BIOS Boot Options for Acer Aspire V5-431P/471P
(I Series)

1. Restart/Shutdown the Laptop
2. Tap F2 key on startup
3. When BIOS interface appears, go to Boot Menu
4. Change Boot Mode to Legacy BIOS.
5. Restart Again the laptop and perform step 2.
6. Set the Boot Priority of Devices using F5/F6.

Monday, September 16, 2013

SQL Server Function Date Range Example

The function below retrieves the top Freight amount specified by date range values
 use CompanySales  
 IF object_id (N'dbo.GetTopFreightValueRange', N'FN') IS NOT NULL  
 drop function GetTopFreightValueRange  
 go  
 create function GetTopFreightValueRange  
 (  
   @startDate nvarchar(50), @endDate nvarchar(50)  
 )  
 returns decimal(10,2)   
 as  
 begin   
 declare @result varchar(50)   
      set @result =   
      (  
            select FreightAmount   
                 from dbo.Orders  
            where CONVERT(VARCHAR(10), ShippedDate, 120) >= @startDate  
                  and  
                  CONVERT(VARCHAR(10), ShippedDate, 120) <= @endDate  
      )  
 return @result  
 end  
 go  
-- select dbo.GetTopFreightValueRange('1996-11-01','1996-11-30') as freight_value;

SQL Server Function return FreightAmount as Decimal

Here's a simple function that will return the freight amount in decimal format.
 use Your_Database_Name  
 if object_id (N'dbo.getFreightValue', N'FN') is not null  
 drop function getFreightValue  
 go  
 create function getFreightValue  
 (  
   @salesID nvarchar(50)  
 )  
 returns decimal(10,2)   
 as  
 begin   
 declare @result varchar(50)   
 set @result =   
 (  
   select Freight   
     from dbo.Orders  
   where OrderID = @salesID   
 )  
 return @result  
 end  
 go  
 -- run function  
 -- select dbo.getSomeValue(10248) as freight_value;  
Cheers!