European Windows 2012 Hosting BLOG

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

SQL Server 2012 Hosting UK - HostForLIFE.eu :: Moving a Table to Another Schema

clock November 20, 2014 05:35 by author Peter

From SQL Server 2005, all tables are grouped into schemas. Even though making a table in case the schema name isn't specified it's developed inside the default schema from the user making it. You are able to use ALTER SCHEMA command to move tables in among schemas. For instance, in case I develop a table using below script it is going to be developed below my default schema that is dbo:
USE [hostsql]
GO
CREATE TABLE Employee
(
       ID     INT,
       Name VARCHAR(20)
)
GO
SELECT name, [schema] = SCHEMA_NAME(schema_id)
FROM   sys.tables
WHERE  name = 'Employee'
GO

Result Set:
name            schema
Employee      dbo
(1 row(s) affected)

As you are able to notice coming from the output the table is currently in dbo schema. Currently to move this table to another schema utilizing ALTER SCHEMA command, first we have to create the schema in case it doesn't exist by now. When that many of us can move table to new schema.
USE [SqlAndMe]
GO CREATE SCHEMA Staff
GO 
ALTER SCHEMA Staff
TRANSFER dbo.Employee
GO 
SELECT name, [schema] = SCHEMA_NAME(schema_id)
FROM   sys.tables
WHERE  name = 'Employee'
GO


Result Set:
name            schema
Employee      Staff 
(1 row(s) affected)

As you can see from the result, the table of Employee is now moved to Staff schema.



SQL Reporting Service (SSRS) 2012 Hosting UK - HostForLIFE.eu :: Remove HTML From a String (T-SQL) on SSRS

clock November 18, 2014 07:55 by author Peter

I have been focusing on SQL Reporting Service (SSRS) 2012 using a supply database that had terribly fascinating worth inside the field. It looked such as HTML upon the website :

It is very annoying for business users to discover some thing similar to this on SSRS report :
SELECT TheName = 'Put your <span style="color: #ff0000; font-weight: bold; text-decoration: underline">name </span>in the box:'

This was a " name " column simply beneath the ID in database and there wasn't some other columns along with no HTML. I'm not so positive in case somebody took a incorrect approach making this field using HTML or that was an intension of the developer creating his life easier on the online interface, however I've determined to get yourself a quick answer to eliminate it and to provide the report when I can.
CREATE FUNCTION fn_RemoveHTMLFromText (@inputString nvarchar(max))
RETURNS nvarchar(MAX)
AS
BEGIN

  /*Variables to store source fielde temporarily and to remove tags one by one*/
  DECLARE @replaceHTML nvarchar(2000), @counter int, @outputString nvarchar(max)
  set @counter = 0
  SET @outputString = @inputString

  /*This was extra case which I've added later to remove no-break space*/
  SET @outputString = REPLACE(@outputString, '&nbsp;', '')

  /*This loop searches for tags beginning with "<" and ending with ">" */
  WHILE (CHARINDEX('<', @outputString,1)>0 AND CHARINDEX('>', @outputString,1)>0)
  BEGIN
    SET @counter = @counter + 1

    /*
    Some math here... looking for tags and taking substring storing result into temporarily variable, for example "</span>"
   */
   SELECT @replaceHTML = SUBSTRING(@outputString, CHARINDEX('<', @outputString,1), CHARINDEX('>',   @outputString,1)-CHARINDEX('<', @outputString,1)+1)

   /* Replace the tag that we stored in previous step */
   SET @outputString = REPLACE(@outputString, @replaceHTML, '')

   /* Let's clear our variable just in case... */
   SET @replaceHTML = ''

   /* Let's set up maximum number of tags just for fun breaking the loop after 15 tags */
  if @counter >15
      RETURN(@outputString);
  END
  RETURN(@outputString);
END

And now, let use the fuction:
SELECT TheName = dbo.fn_RemoveHTMLFromText ('Put your <span style="color: #ff0000; font-weight: bold; text-decoration: underline">name </span>in the box:')

And finally, this is what I wanna see:

This is simply easy resolution that has been applied upon the field along with not so many HTML tags, other then may be simply changed into more serious HTML cleaner.



France European SQL 2008 R2 Hosting - HostForLIFE.eu :: How to Change SMTP servers on Database Mail with SQL Server??

clock November 13, 2014 08:43 by author Peter

The database I inheritable when I started my current job sends out a lot of mails. It does therefore using database Mail with SQL Server, and it's a lot of mail accounts and mail profiles outlined. I do know that many of these profiles are used, i think that some aren't, and that I haven't any plan concerning the rest – in the future I'll notice the time to clean up, however to this point there have always been a lot of pressing matters to attend to.

But nowadays the mail administrator told me that thanks to a modification in design, SQL Server had to start using a completely different SMTP server for sending mails. Quite easy task if you've got just a single profile. Just a couple of clicks within the database Mail Configuration Wizard, and done. But continuation those self same mouse-clicks for each profile within the list wasn't my plan of a morning well spent, therefore I made a decision that I’d got to script this. (This ought to be easy – we've just a single SMTP server, therefore I may hit each single mail account and did not get to trouble with exceptions).

Usually, scripts for such a task are terribly easy. You just type a felicitous search string in your favorite Search Engine, check the primary 2 or 3 hits, and you’ll have a script. Sometimes even over one. Carefully inspect the script,copy the script, paste into SSMS, build adjustments for your own scenario, do a new review simply to take care. Bottom line, I did not notice a pre-made script for this task, therefore I put in the effort to put in writing one, so determined to share it with you.

Note that the script below was tested on SQL Server 2008R2 only. also note that it'll update all mail accounts to use the new SMTP server. If you've got a a lot of complicated setup with multiple servers and just some got to change, you may got to add the correct filtering criteria to the wherever clause.

DECLARE @NewServer sysname = 'NotTelling.mail', -- New SMTP server
        @OldServer sysname = 'MySecret.mail',   -- Old SMTP server
        @account_id int;
DECLARE Cursor_MailAccounts CURSOR LOCAL FORWARD_ONLY STATIC READ_ONLY
FOR SELECT account_id
    FROM   msdb.dbo.sysmail_server
    WHERE  servername = @OldServer;             -- Add extra logic here
OPEN Cursor_MailAccounts;

FETCH NEXT
FROM  Cursor_MailAccounts
INTO  @account_id;

WHILE @@FETCH_STATUS = 0
BEGIN;
    EXECUTE msdb.dbo.sysmail_update_account_sp
                @account_id = @account_id,
                @mailserver_name = @NewServer;
   
    FETCH NEXT
    FROM  Cursor_MailAccounts
    INTO  @account_id;
END;

CLOSE Cursor_MailAccounts;
DEALLOCATE Cursor_MailAccounts;

I hope it will works for you!



European Crystal Report 2013 Hosting - HostForLIFE.eu :: How to Display Records from Database using Crystal Report Viewer?

clock November 11, 2014 06:12 by author Peter

In  this tutorial, I will tell you how to display records from your database using Crystal Report 2013 Hosting. Crystal Report 2013 is an integrated development environment you'll be able to use to form applications and libraries with many alternative frameworks and languages. it's a rich feature set together with an intelligent editor, built in compiler (and related tools) and context sensitive facilitate. SAP Crystal Reports 2013 (Crystal Reports) is intended to figure along with your database to assist you analyze and interpret vital data. Crystal Reports makes it straightforward to form simple reports, and, it conjointly has the great tools you would like to provide advanced or specialized reports.

Crystal Reports will facilitate a company build sensible business selections. It will provide you with a warning to areas of a business's operations that aren't performing on all cylinders, or means areas that are a model for excellence. Reports will permit staff to target the business info instead of the production of data. Application and net developers will save time and meet their users wants by integrating the report process power of Crystal Reports into their info applications.

And here is code for Default.aspx file
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ReportViewer._Default" %>
<%@ Register assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">   
<title>Untitled Page</title>
</head><
body>
    <form id="form1" runat="server">
    <div>
    <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
        AutoDataBind="true" />
    </div>
    </form>
</body>
</html>

And now, here is the Default.aspx.cs code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;

namespace ReportViewer{
    public partial class _Default : System.Web.UI.Page
    {
        string connStr =
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlDataAdapter sqlda = new SqlDataAdapter();
        SqlCommand com = new SqlCommand();
        DataTable dt;
        DataSet1 ds=new DataSet1();
        ReportDocument rptDoc=new ReportDocument(); 
        protected void Page_Load(object sender, EventArgs e)
        {
            bindReport(); 
        }
        private void bindReport()
        {            
            SqlConnection conn = new SqlConnection(connStr);
            dt = new DataTable();
            dt.TableName = "Crystal Report Example";
            com.Connection = conn;
            com.CommandText = "SELECT * FROM product";
            sqlda = new SqlDataAdapter(com);
            sqlda.Fill(dt);
            ds.Tables[0].Merge(dt);
            rptDoc.Load(Server.MapPath("CrystalReport1.rpt"));
            rptDoc.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = rptDoc; 
        }
    }



HostForLIFE.eu Windows Hosting Proudly Launches New Data Center in Paris (France)

clock November 10, 2014 10:53 by author Peter

HostForLIFE.eu, a leading Windows web hosting provider with innovative technology solutions and a dedicated professional services team proudly announces New Data Center in Paris (France) for all costumers. HostForLIFE’s new data center in Paris will address strong demand from customers for excellent data center services in Europe, as data consumption and hosting services experience continued growth in the global IT markets.

The new facility will provide customers and our end users with HostForLIFE.eu services that meet in-country data residency requirements. It will also complement the existing HostForLIFE.eu. The Paris (France) data center will offer the full range of HostForLIFE.eu web hosting infrastructure services, including bare metal servers, virtual servers, storage and networking.

HostForLIFE.eu expansion into Paris gives us a stronger European market presence as well as added proximity and access to HostForLIFE.eu growing customer base in region. HostForLIFE.eu has been a leader in the dedicated Windows & ASP.NET Hosting industry for a number of years now and we are looking forward to bringing our level of service and reliability to the Windows market at an affordable price.

The new data center will allow customers to replicate or integrate data between Paris data centers with high transfer speeds and unmetered bandwidth (at no charge) between facilities. Paris itself, is a major center of business with a third of the world’s largest companies headquartered there, but it also boasts a large community of emerging technology startups, incubators, and entrepreneurs.

Our network is built from best-in-class networking infrastructure, hardware, and software with exceptional bandwidth and connectivity for the highest speed and reliability. Every upstream network port is multiple 10G and every rack is terminated with two 10G connections to the public Internet and two 10G connections to our private network. Every location is hardened against physical intrusion, and server room access is limited to certified employees.

All of HostForLIFE.eu controls (inside and outside the data center) are vetted by third-party auditors, and we provide detailed reports for our customers own security certifications. The most sensitive financial, healthcare, and government workloads require the unparalleled protection HostForLIFE.eu provides.

Paris data centres meet the highest levels of building security, including constant security by trained security staff 24x7, electronic access management, proximity access control systems and CCTV. HostForLIFE.eu is monitored 24/7 by 441 cameras onsite. All customers are offered a 24/7 support function and access to our IT equipment at any time 24/7 by 365 days a year.

For more information about new data center in Paris, please visit http://hostforlife.eu/Paris-Hosting-Data-Center

About HostForLIFE.eu
HostForLIFE.eu is an European Windows Hosting Provider which focuses on the 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. 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.



SQL 2014 Hosting Italy - HostForLIFE.eu :: How to Kill all sessions using database in MSSQL 2014

clock November 4, 2014 07:56 by author Peter

At this moment, we are going to discussed about: How to Kill all sessions in MSSQL using database. Before an existing database are often restored, there ought to be connections using the database in question. If the database is presently in use the RESTORE command fails with error on below:
Msg 3101, Level 16, State 1, Line 2
Exclusive access could not be obtained because the database is in use.
Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.

To avoid that error, we'd like to kill all sessions using the database in MSSQL. All sessions using the database are often queries using system hold on procedure sp_who2 or using sys.dm_exec_sessions DMV:
SELECT   session_id
FROM     sys.dm_exec_sessions
WHERE    DB_NAME(database_id) = 'SqlAndMe'

You need to terminate every of the sessions came back one by one by using KILL command. If there are sizable amount of sessions to kill, otherwise you got to try this on a routine basis it gets boring to do it this manner. you'll be able to *automate* this using below script, that takes database name as input, and kills all sessions connecting to that.
USE [master]
GO 
DECLARE @dbName SYSNAME
DECLARE @sqlCmd VARCHAR(MAX) 
SET @sqlCmd = ''
SET @dbName = 'SqlAndMe' -- Change database NAME
 SELECT   @sqlCmd = @sqlCmd + 'KILL ' + CAST(session_id AS VARCHAR) +
         CHAR(13)
FROM     sys.dm_exec_sessions
WHERE    DB_NAME(database_id) = @dbName 
PRINT @sqlCmd
--Uncomment line below to kill
--EXEC (@sqlCmd)

Hope this tutorial works for you!



SQL Server 2012 Hosting - HostForLIFE.eu :: How to fix Error: The specified instance of SQL Server is hosted by a system that is not a Windows Server Failover Cluster(WSFC) node

clock October 30, 2014 08:43 by author Peter

Today, I will write about How to fix Error:  “The specified instance of SQL Server is hosted by a system that is not a Windows Server Failover Cluster(WSFC) node" on SQL Server 2012. And this is the error message:

The specified instance of SQL Server is hosted by a system that is not a Windows Server Failover Cluster(WSFC) node. (Microsoft.SqlServer.Management.HadrTasks)

The local node is not part of quorum and is therefore unable to process this operation. This may be due to one of the following reasons:

  • The local node is not able to communicate with the WSFC cluster.
  • No quorum set across the WSFC cluster.

The local node isn’t part of quorum and so unable to process that operation.This prompt me that perhaps the second instance doesn't understand itself its HADR enable. thus I qery sys.dm_hadr_cluster_members and sys.dm_hadr_cluster for both nodes.

On node1, it will come correct information. On node2, the result's empty.
SELECT *
FROM sys.dm_hadr_cluster_members;
Go
select * from sys.dm_hadr_cluster

The way to fix it's disable the HADR from SQL Server configuration manager . Bounce SQL Server and SQL agent. rentable HADR and bounce SQL server and SQL agent. The issue was resolved after second bounce

.



Europe Joomla 3.4 Hosting - HostForLIFE.eu :: How to Reset or Recover Your Joomla Admin Password from Database

clock October 28, 2014 09:56 by author Peter

Today, I want to write about Change the Password Directly from Database on Joomla 3.4 Hosting. First, If the admin user is already defined, the best way is to vary the password within the database to a known password. This method requires that you just have direct access to the MySQL database using phpMyAdmin or another client.

Cautions: change your password after login

Following steps show how to manually reset a password to the word - "Admin"

1. Open phpMyAdmin and choose the database of your Joomla web site. On the Left Top side of the dropdown list will appear. It'll show all the database tables.
2. Find a table  " prefix_users" in the list of tables (note: prefix can depend upon your prefix value.).
3. Click on the "Browse" button in the top toolbar. it'll show all of the users for this web site.
4. Click on the " Edit icon " for user whose word you would like to change.
5. Modify password value to the following 
09b135d0d2022f04d1d679afec90cfc6:9z78xfHz0TFnmI8d4jHtvmk0QxayQJUv 


into the password field and press the Go button.

6. Log in with this user and password (Admin).

7. Then, after you logging again, change password from user Manager for this user.
8. Now, Select all of the users in User manager and also modify the password of others if your website was hacked.



PrestaShop 1.6 Hosting - HostForLIFE.eu :: How to Managing Product Attributes in PrestaShop

clock October 23, 2014 11:45 by author Peter

Today, I will show you how to manage product attributes in PrestaShop 1.6. Attributes on PrestaShoip are the basis of product variations. You can only create variations of a product if at least one of its attributes changes and you can add multiple attributes.

1. First, You must Log Into your Prestashop 1.6  admin panel and Click on Catalog -> Product Attributes

2. Click the Add New Attributes button within the top right corner

3. On the Catalog -Attributes and Values - Add new Attribute web page enter the subsequent fields:

  • name: for instance, shade (the name is perhaps not visible to the web page visitors)
  • Public identify: e.g. shade (visible to your website visitors)
  • URL: specific url layout in block layered generation
  • Meta title: specific format for meta title
  • Indexable: Use this attribute in url generated through the layered navigation module
  • Attribute type: create a choice the type of the attribute

4. Then, Click Save. You're getting to see the attribute you only added in the list.

Now, We’ll Add the Attribute Values on Prestashop 1.6

1. On Catalog select Product Attributes, then click Add New Value.

2. Enter the fields as below:

  • Attribute group: Select the type of the attribute, example: Color, etc.
  • Value: The name of the value itself, for instance for Color.
  • Meta title: The Specific format for your meta title.
  • Color: You can Select a color with the color picker, or enter an HTML color code.
  • Texture: Upload color texture from your PC.

4. Click on Save button at the bottom right or Save then add another value to feature additional values.
5. You may see all the values you added if you click Edit button for the attribute you added the values to under Catalog -> Product Attributes . You'll additionally edit or delete them from there.



Umbraco 7.2 Hosting UK - HostForLIFE.eu :: Tips to Organize Your Umbraco URLs

clock October 21, 2014 09:57 by author Peter

Here are some tips and tricks you'll be able to use for Umbraco 7.2 CMS related developments. You'll be ready to use the following techniques to organise your Umbraco page URLs.

NiceUrl
This is the most common method for us to return a "Friendly URL" for a given node within the Umbraco content section. As explained in Umbraco, a 'Friendly url' is the complete encoded URL excluding the domain. however this relies on the settings you tack in UmbracoSettings.config file. If you set useDomainPrefixes=true in UmbracoSettings.config, NiceUrl returns the url as well as the domain.

NiceUrl with XSLT
Code for Return current page URL

<xsl:value-of select="umbraco.library:NiceUrl($currentPage/@id)" />
This code will return hyperlink to parent page
<a href="{umbraco.library:NiceUrl($currentPage/../@id)}">
  <xsl:value-of select="$currentPage/../@nodeName" />
</a>

NiceUrl with Razor
Return current page URL
@umbraco.library.NiceUrl(Model.Id)
Hyperlink to parent page;
<a href="@umbraco.library:NiceUrl(Model.Parent.Id)">
  @Model.Parent.Name
</a>

Model is basically Razors equivalent of "$currentPage" in XSLT.

NiceUrl with C#
This will get the current page URL to a string

var currentNode = umbraco.presentation.nodeFactory.Node.GetCurrent();
string pageURL = umbraco.library.NiceUrl(currentNode.Id);
This will get the parent page URL to a string;
var currentNode = umbraco.presentation.nodeFactory.Node.GetCurrent();
string parentPageURL = umbraco.library.NiceUrl(currentNode.Parent.Id);

umbracoUrlAlias
As Umbraco explains, using the "umbracoUrlAlias" alias with a text-string property can change you to supply multiple URLs for a content node. For example if we were to enter "news,events/upcoming-events", this is able to resolve the following URLs to the same page
.
/news.aspx
/events/upcoming-events.aspx

Things to note: you must perpetually use umbracoUrlAlias field value in lowercase letters, not use a leading slash and not use a trailing ".aspx".



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