European Windows 2012 Hosting BLOG

BLOG about Windows 2012 Hosting and SQL 2012 Hosting - Dedicated to European Windows Hosting Customer

SQL Server 2012 Hosting Spain - HostForLIFE.eu :: How to to check Recovery Model of a database in SQL Server ?

clock January 13, 2015 06:34 by author Peter

A Recovery Model is property of a database that control how transaction log is maintained. SQL Server supports simple, FULL and BULK-LOGGED recovery models. There are multiple ways in which to check recovery model of a database in SQL Server.

1. Using SQL Server Management Studio:
Right click on database in Object explorer -> Go to Properties dialog box -> Options page -> Recovery model

2. Using Metadata function – DATABASEPROPERTYEX():
SELECT [RecoveryModel] = DATABASEPROPERTYEX('SqlAndMe','Recovery')
GO 


Result Set: 
RecoveryModel
SIMPLE 

3. Using catalog view – sys.databases:
SELECT [DatabaseName] = name,
       [RecoveryModel] = recovery_model_desc
FROM   sys.databases
GO  


Result Set:
DatabaseName   RecoveryModel
master         SIMPLE
tempdb         SIMPLE
model          FULL
msdb           SIMPLE
Pubs           SIMPLE
EuWindows      SIMPLE
TestDB         SIMPLE
ProductCatalog SIMPLE
ReportDemo     SIMPLE
ReportServer   FULL
ReportServerTempDB  SIMPLE

(11 row(s) affected)

Using sys.databases catalog view is easier as it returns information of all databases on server. Hope this tutorial works for you!

 



SQL Server 2012 Hosting UK - HostForLIFE.eu :: Number of words in a string on SQL Server

clock January 9, 2015 06:01 by author Peter

In SQL Server there is not any inherent capacity accessible for discovering the number of words in a String. Here I reveal to both of you diverse methodologies for doing this, the first is the most simpleone, and is applicable only of these words are separated by a single space.

DECLARE @String VARCHAR(4000)
SELECT @String = 'SQL Server 2005'
SELECT LEN(@String) - LEN(REPLACE(@String, ' ', '')) + 1

As I said prior, the above query will provides for you the right result, just if the words are differentiated with a solitary space. Presently on the off chance that they are differentiated by more than one space, this will provide for you off base results as the results are basically relied on upon  Length of the original string. Along these lines, what will be the arrangement, simply compose a function  to do this.

CREATE FUNCTION dbo.udfWordCount(
@OriginalText VARCHAR(8000)
)
RETURNS int
as
/*
SELECT dbo.udfWordCount ('hello   world')
*/
BEGIN
    DECLARE @i int ,@j INT, @Words int
    SELECT     @i = 1, @Words = 0
    WHILE @i <= DATALENGTH(@OriginalText)
    BEGIN
        SELECT    @j = CHARINDEX(' ', @OriginalText, @i)
       if @j = 0
        BEGIN
            SELECT    @j = DATALENGTH(@OriginalText) + 1
        END
        IF SUBSTRING(@OriginalText, @i, @j - @i) <>' '
              SELECT @Words = @Words +1
        SELECT    @i = @j +1
    END
    RETURN(@Words)
END
GO
SELECT dbo.udfWordCount ('SQL Server2012')
SELECT dbo.udfWordCount ('SQL Server 2012 ')

 



SQL Server 2014 Hosting Russia - HostForLIFE.eu :: Restart Interrupted Restore Operations

clock January 8, 2015 07:19 by author Peter

Circumstances in which a restore operation is hindered are not exceptionally remarkable. This is the reason, in this post, we will demonstrate to you what you need to do with a specific end goal to restart the interrupted operation using T-SQL queries in SQL Server 2014.

In the event that your restore operation was interrupted, you can at present restart the methodology and proceed starting there where it got intruded.

This is a peculiarity that can be extremely valuable in the event that you have huge databases which you need to restore. On the off chance that the methodology of restoring falls flat near to the end, the majority of the times you can restart the whole operation from the point where it cleared out off, as opposed to restarting the whole restore procedure of the database.

To be particular, when you make your restore from tape, you can restart from the current tape as opposed to restarting from the first. Anyhow, if the restore was in the stage when it was being rolled forward, then no information will be replicated from that backup set.

Restart interrupted restore with T-SQL
In the event that you have utilized a T-SQL query to restore your database and the methodology was hindered for any reason, known or obscure, then what you need to do is to define a RESTART proviso toward the end of the same inquiry and run the question yet again.

Let’s assume that you have the following query, or something similar, and it got interrupted during execution.
-- Restore a full database backup of myDB database
RESTORE DATABASE myDB
FROM DISK = 'C:\myDB.bak'
GO

Presently, keeping in mind the end goal to proceed with and interrupted restore operations, connected for our situation, we are going to utilize the query from above completed with the WITH RESTART clause.

-- Just run the initial RESTORE statement specifying WITH RESTART in order to restart interrupted restore operations
RESTORE DATABASE myDB
FROM DISK = 'C:\myDB.bck'
WITH RESTART
GO



SQL Reporting Service (SSRS) 2014 Hosting - HostForLIFE.eu :: How to Get the List of All Reports Using the Query ?

clock January 6, 2015 05:34 by author Peter

This can be a decent administrator device to screen all reports create on SSRS case and it can be helpful particularly if the rundown of your reports is getting huge.  It's a basic question on "Reportserver" database which can be once in a while named differently much the same as mine is: "Reportserver$mike" (named occasions), yet for SSRS introduced on default case it ought to be this one from beneath:

USE [ReportServer]
GO
SELECT
  Name,
  [Path]
  --,[Description]
FROM [dbo].[Catalog]
WHERE [Type] = 2
ORDER BY [Path]


Result:
Name Path
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AdventureWorks_Base /AdventureWorks/AdventureWorks_Base
Customers_Near_Stores /AdventureWorks/Customers_Near_Stores
Employee_Sales_Summary /AdventureWorks/Employee_Sales_Summary
Sales_by_Region /AdventureWorks/Sales_by_Region
Sales_Order_Detail /AdventureWorks/Sales_Order_Detail
Store_Contacts /AdventureWorks/Store_Contacts
(6 row(s) affected)


Likewise, here is a little extensio for the query which I want to utilize this one with guardian envelope structure included:
USE [ReportServer]
GO
SELECT
  Name,
  FullPath = [Path]
  ,ReportParentPath = REVERSE(SUBSTRING(REVERSE(Path), CHARINDEX('/', REVERSE(Path)), LEN(REVERSE(Path))))
  --,[Description]
FROM [dbo].[Catalog]
WHERE [Type] = 2
ORDER BY [Path]


For more extensive checking contemplations I prescribe probably the most vital tables in Reportserver database: USE [ReportServer]
GOSELECT * FROM [Catalog]
SELECT * from [dbo].[DataSets]
SELECT * FROM [dbo].[DataSource]
SELECT * FROM [dbo].[Users]



HostForLIFE.eu Proudly Launches DotNetNuke 7.3.4 Hosting

clock December 23, 2014 07:46 by author Peter

European leading web hosting provider, HostForLIFE.eu announced support for DotNetNuke 7.3.4 hosting plan due to high demand of DotNetNuke CMS users in Europe.

HostForLIFE.eu proudly launches the support of DotNetNuke 7.3.4 on all our newest Windows Server  environment. HostForLIFE.eu DotNetNuke 7.3.4 Hosting plan starts from just as low as €3.00/month only and this plan has supported ASP.NET 5, ASP.NET MVC 5/6 and SQL Server 2012/2014.

DotNetNuke 7.3.4, as well known in the web industry and familiar among .NET developers, is a Web Content Management System (WCMS) based on Microsoft .NET platform. It is an excellent open source software that you can use to manage your website without having much technical knowledge.

HostForLIFE.eu clients are specialized in providing supports for DotNetNuke for many years. We are glad to provide support for European DotNetNuke 7.3.4 hosting users with advices and troubleshooting for our clients website when necessary.

DNN 7.3.4 is a smaller maintenance release than normal and is focused on addressing the most serious platform issues. DNN 7.3.4 addresses a number of platform issues and should be the last release before DNN 7.4.0. DNN 7.3.4 added ability to save localized lists to resource file, added method to remove all subscriptions from a ContentItem, fixed issue where AUM was not correctly handling 301 redirects, Fixed issue where popup iframe is not initialized correctly and fixed issue where multiple region/country controls in a profile did not work correctly.

DotNetNuke 7.3.4 will be a great content management system that support many advance website features such as blogs, forums, e-commerce system, photo galleries and more. DotNetNuke 7.3.4 is a great platform to build your web presence with. HostForLIFE.eu can help customize any web software that company wishes to utilize.

Further information and the full range of features DotNetNuke 7.3.4 Hosting can be viewed here http://www.hostforlife.eu/European-DotNetNuke-734-Hosting

About Company
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.asp.net/hosting/hostingprovider/details/953). Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries.



Kentico 8.1 Hosting Italy - HostForLIFE.eu :: Smart Search Index Rebuilding Scheduled Task in Kentico 8.1

clock December 18, 2014 11:18 by author Peter

During my recents projects in Kentico 8.1, I had to tack together the search engine to own search fields on the web site. The search engine included in Kentico is Lucene, a full text search engine supported physical files indexes. For every web site, you wish to build on rebuild basis the different search indexes you define in Kentico. During this case, I assumed that the regular Task "Optimize search indexes", defined by default in Kentico, was doing this calculation of search indexes. My assumption was wrong, there's actually no regular task doing the index rebuilding.

So, because we did not wish to log every night to my sites to launch manually each index rebuilding, I enforced my own scheduled task for doing it, here is the source code :

using System;
using CMS.EventLog;
using CMS.Scheduler;
using CMS.SiteProvider;
using System.Data;
namespace MyProject.Services.ScheduledTasks
{
    public class SmartSearchReIndexTask: ITask
    {
        private const string Name = "SmartSearchReIndexTask";
        public string Execute(TaskInfo task)
        {
            var response = " Reindexing smart search updated successfully.
";
            const string eventCode = "Smart Search Execution";           
           try
            {
                //retrieve Planet search indexes

                EventLogProvider.LogInformation(Name, eventCode, "Start reindexing");
                DataSet indexes = SearchIndexInfoProvider.GetSearchIndexes("IndexName LIKE N'MyProject%'", null);
                if (indexes != null)
                {
                    foreach (DataTable table in indexes.Tables)
                   {
                        foreach (DataRow row in table.Rows)
                        {
                            //create a reindex task for that search index
                           
SearchIndexInfo searchIndexInfo = SearchIndexInfoProvider.GetSearchIndexInfo(Convert.ToInt32(row.ItemArray[0]));  
//row.ItemArray[0] is the SearchIndex ID
                            if (searchIndexInfo != null)
                            {
                                SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Rebuild, searchIndexInfo.IndexType, null, searchIndexInfo.IndexName);                               
System.Threading.Thread.Sleep(100);
                                EventLogProvider.LogInformation(Name, eventCode, string.Format("Recalculating the index: {0}", searchIndexInfo.IndexName));
                            }
                        }
                    }
                }
                EventLogProvider.LogInformation(Name, eventCode, response);               
            }
            catch (Exception ex)
           {
                response = "Error reindexing smart search . Check the event log for more information.";
                EventLogProvider.LogException(Name, eventCode, ex);
            }
            return response;
        }
    }
}

Put this code in a library, put this library in the bin folder of your Kentico 8.1 site and then configure a new custom task.



SQL Server 2012 Hosting UK - HostForLIFE.eu :: Remove the Special Characters in a String

clock December 16, 2014 07:30 by author Peter

Today, I am going to tell you how to replace the special characters in a string with spaces. In this case, I need to use PATINDEX.

PATINDEX
It will returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types. And this is the code that I used:
PATINDEX ( '%pattern%' , expression )

Example:
DECLARE @Str varchar(100)
SET @Str='Welcome!@+to+#$%SQL+^&*(SERVER)_+'
SELECT PATINDEX('%SQL%', @Str)


Here is the result from that code:

Remove Special Characters from String in SQL Server DECLARE @regexp INT
DECLARE @Str varchar(100)
SET @Str='Welcome!@+to+#$%SQL+^&*(SERVER)_+   '
SET @regexp = PATINDEX('%[^a-zA-Z0-9 ]%', @Str)
WHILE @regexp > 0
BEGIN
SET @Str = STUFF(@Str, @regexp, 1, ' ' )
SET @regexp = PATINDEX('%[^a-zA-Z0-9 ]%', @Str)
Print @regexp
END
SELECT @Str


Result
:

STUFF
This STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position. This is the code:
STUFF ( character_expression , start , length , replaceWith_expression )


Example:
DECLARE @regexp INT
DECLARE @Str varchar(100)
SET @Str='welcome to sql server'
SET @Str = STUFF(@Str, 1, 1, '@' )
Select @str 



HostForLIFE.eu Proudly Launches of WordPress 4.0.1 Hosting

clock December 15, 2014 10:11 by author Peter

European leading web hosting provider, HostForLIFE.eu announced the support for WordPress 4.0.1 hosting plan due to high demand of WordPress 4.0.1 users in Europe. HostForLIFE.eu is a popular online WordPress hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering fast, fully-managed and secured services in the competitive market.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam (NL), London (UK), Paris (France) and Seattle (US) to guarantee 99.9% network uptime. All data center feature redundancies in network connectivity, power, HVAC, security, and fire suppression. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee. The customer can start hosting our Wordpress 4.0.1 site on our environment from as just low €3.00/month only.

WordPress 4.0.1 patches a critical cross-site scripting vulnerability affecting comment boxes on websites running the content management system software. An attacker would need only to inject malicious JavaScript into a comment that would infect a reader viewing it on the webpage or an admin in the management dashboard.

The update also addresses three other cross-site scripting vulnerabilities, a cross-side request forgery flaw, a denial-of-service bug related to password checks, server-side request forgery issues, and what WordPress called “an extremely unlikely hash collision” that could lead to account compromise. WordPress said it also invalidates links in a password reset email if the user remembers our password and logs in and changes our email address.

WordPress 4.0.1 addresses an additional eight security issues, including three other XSS vulnerabilities that can be exploited by a contributor or an author, a cross-site request forgery (CSRF) that can be leveraged to trick a user into changing his/her password, and a denial-of-service (DoS) bug. HostForLIFE.eu is a popular online Windows based hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market. Our powerful servers are specially optimized and ensure WordPress 4.0.1 performance.

For more information about this new product, please visit http://hostforlife.eu/European-WordPress-401-Hosting

About us:
HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.asp.net/hosting/hostingprovider/details/953). Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, we have also won several awards from reputable organizations in the hosting industry and the detail can be found on our official website.



European Umbraco 7 Hosting - UK :: How to Fix Error The virtual path ‘/install/steps/welcome.ascx’ maps to another application, which is not allowed.

clock December 11, 2014 08:02 by author Scott

Sometimes you’ll get this error message that you’ll get after installing Umbraco:

The virtual path ‘/install/steps/welcome.ascx’ maps to another application, which is not allowed.

This is because you have installed Umbraco in a virtual directory (not at the web root of the “Default Web Site” in IIS terminology). It is a path problem, easily corrected by fixing the paths in the web.config file.

In the example below, you can see that Umbraco is installed in a virtual directory called “umbraco” which is a child of the Default Web Site. This will cause the standard paths to be incorrect. This installation was done with Microsoft’s Web Platform Installer, which does not appear to correct for the problem.

Here is a copy of the appsettings portion of web.config file (located inside the umbraco folder) with the paths corrected for the folder configuration shown above. Just open it up and edit it with notepad to fix.

<appSettings>
<add key="umbracoDbDSN" value="datalayer=SqlServer;server=server;database=db;user id=dbuser;password=password" />
<add key="umbracoConfigurationStatus" />
<add key="umbracoReservedUrls"
value="/umbraco/config/splashes/booting.aspx,/umbraco/install/default.aspx,/umbraco/config/splashes/noNodes.aspx" />
<add key="umbracoReservedPaths" value="/umbraco/umbraco/,/umbraco/install/" />
<add key="umbracoContentXML" value="/umbraco/data/umbraco.config" />
<add key="umbracoStorageDirectory" value="/umbraco/data" />
<add key="umbracoPath" value="/umbraco/umbraco" />
<add key="umbracoEnableStat" value="false" />
<add key="umbracoHideTopLevelNodeFromPath" value="true" />
<add key="umbracoEditXhtmlMode" value="true" />
<add key="umbracoUseDirectoryUrls" value="false" />
<add key="umbracoDebugMode" value="true" />
<add key="umbracoTimeOutInMinutes" value="20" />
<add key="umbracoVersionCheckPeriod" value="7" />
<add key="umbracoDisableXsltExtensions" value="true" />
<add key="umbracoDefaultUILanguage" value="en" />
<add key="umbracoProfileUrl" value="profiler" />
<add key="umbracoUseSSL" value="false" />
<add key="umbracoUseMediumTrust" value="false" />
</appSettings>



SQL Server 2014 Hosting Spain - HostForLIFE.eu :: How to Check Fragmentation in SQL Server ?

clock December 9, 2014 07:48 by author Peter

When you have performance problems in your MSSQL database, one of the first thing you must to verify is that the fragmentation. When the fragmentation is high, SQL Server has got the chance to both reorganize or rebuild indexes. You are able to detect index fragmentation by making use of Dynamic Management View (DMV) sys.dm_db_index_physical_stats and verify the avg_fragmentation_in_percent column.

Use [MyDB];
SELECT a.index_id, name, avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS a
   JOIN sys.indexes AS b ON a.object_id = b.object_id
AND a.index_id = b.index_id
ORDER BY avg_fragmentation_in_percent DESC;


When the value avg_fragmentation_in_percent in among 5% and 30% you ought to perform a reorganize of your indexes, not really a total rebuild. A rebuild you simply need invoked when the fragmentation percentage is more than 30%. No action ought to be taken when the fragmentation proportion is lower than 5% and that is a standard level of fragmentation.

The code below can rebuild all indexes with default fill factor:
Use [MyDB];
EXEC sp_MSforeachtable
  @command1="print '?'",
  @command2="ALTER INDEX ALL ON ? REBUILD WITH (ONLINE=OFF)"

Hope this code will helps you!

 



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in