European Windows 2012 Hosting BLOG

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

SQL Server 2014 Hosting Belgium - HostForLIFE.eu :: How to Calculate Total Rows Inserted per Second ?

clock January 29, 2015 06:31 by author Peter

In this tutorial, I will write an article about How to Calculate Total Rows Inserted per Second in SQL Server 2014. Ever expected to compute the quantity of columns embedded consistently, for each table in every database on a server? Alternately, have you ever expected to approve that all methods have quit keeping in touch with tables? These sorts of inquiries come up routinely for me. To help with this, I've composed the following script, which inspects metadata qualities utilizing sys.partitions. This system isn't as precise as running SELECT COUNT(*) FROM, however its much quicker.

Remember, since it’s just looking at row counts, its very little help on tables that have a considerable measure of update/delete  action. Yet it does what I need it to do, and I utilize it pretty frequently, so I thought I'd experience case any other individual can advantage from it as well.

/* Declare Parameters */
DECLARE @newBaseline BIT = 1 -- change to 0 when you don't want to replace the baseline, i.e. after initial run
  , @delay CHAR(8) = '00:00:30'; -- change as needed 
IF @newBaseline = 1
BEGIN
    IF OBJECT_ID('tempdb..#baseline') IS NOT NULL
        DROP TABLE #baseline; 
    CREATE TABLE #baseline
    (
         database_name  SYSNAME
       , table_name     SYSNAME
       , table_rows     BIGINT
       , captureTime    DATETIME NULL
    );
END 

IF OBJECT_ID('tempdb..#current') IS NOT NULL
    DROP TABLE #current;
 CREATE TABLE #current
(
     database_name  SYSNAME
   , table_name     SYSNAME
   , table_rows     BIGINT
   , captureTime    DATETIME NULL
); 
IF @newBaseline = 1
BEGIN
    EXECUTE sp_MSforeachdb 'USE ?;
        INSERT INTO #baseline
        SELECT DB_NAME()
            , o.name As [tableName]
            , SUM(p.[rows]) As [rowCnt]
            , GETDATE() As [captureTime]
        FROM sys.indexes As i
        JOIN sys.partitions As p
            ON i.[object_id] = p.[object_id]
           AND i.index_id  = p.index_id
        JOIN sys.objects As o
            ON i.[object_id] = o.[object_id]
        WHERE i.[type] = 1
        GROUP BY o.name;' 
    WAITFOR DELAY @delay;
END
 EXECUTE sp_MSforeachdb 'USE ?;
INSERT INTO #current
SELECT DB_NAME()
    , o.name As [tableName]
    , SUM(p.[rows]) As [rowCnt]
    , GETDATE() As [captureTime]
FROM sys.indexes As i
JOIN sys.partitions As p
    ON i.[object_id] = p.[object_id]
   AND i.index_id  = p.index_id
JOIN sys.objects As o
    ON i.[object_id] = o.[object_id]
WHERE i.[type] = 1
GROUP BY o.name;' 
SELECT  c.*
      , c.table_rows - b.table_rows AS 'new_rows'
      , DATEDIFF(second, b.captureTime, c.captureTime) AS 'time_diff'
      , (c.table_rows - b.table_rows) / DATEDIFF(second, b.captureTime, c.captureTime) AS 'rows_per_sec'
FROM #baseline AS b
JOIN #current AS c
    ON b.table_name = c.table_name
   AND b.database_name = c.database_name
ORDER BY new_rows DESC;

HostForLIFE.eu SQL Server 2014 Hosting
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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Visual Studio 2015 Hosting Netherlands - How to Use TreeView Control in VB.NET ?

clock January 27, 2015 05:39 by author Peter

The Windows Forms Tree view in VB.NET control helps to show the hierarchy of nodes that may be wont to represent the organization structure, file system or the other system which incorporates hierarchical illustration. For each node additional within the hierarchy, user will add a child node to it or a sibling node to it provided there's a parent node for the chosen node present.

The article below explores the Tree read management and depicts the method as a way to add a toddler node or a relative node to the chosen node.

1. How to add a toddler node to a particular node
Create a tree node object and so add it to the chosen node within the management.
Below is that the code to try to to that:
Dim tnode As New TreeNode(textBox1.Text)
treeView1.SelectedNode.Nodes.Add(tnode)
treeView1.ExpandAll()
If treeView1.SelectedNode.Nodes.Count > 1 And treeView1.SelectedNode.ForeColor <> Color.Blue Then
treeView1.SelectedNode.ForeColor = Color.Brown
End If

2. How to add a sibling to a selected node
To add a sibling to a specific node (provided it's a parent node)
Below code implements this concept:
Dim tnode As New TreeNode(textBox1.Text)
tnode.ForeColor = Color.Brown
treeView1.SelectedNode.Parent.Nodes.Add(tnode)

3. Delete a particular selected node
Use the remove methodology to delete the chosen node.
treeView1.SelectedNode.Remove()

4. Use of context Menu

All the on top of 3 cases are often performed via use of context menu also.

Thus a user can use this control for displaying the hierarchical structures.

HostForLIFE.eu Visual Studio 2015 Hosting
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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



HostForLIFE.eu Proudly Launches Sitefinity 7.3 Hosting

clock January 26, 2015 10:08 by author Peter

HostForLIFE.eu, a leading web hosting provider, has leveraged its gold partner status with Microsoft to launch its latest Sitefinity 7.3 Hosting support.

European Recommended Windows and ASP.NET Spotlight Hosting Partner in Europe, HostForLIFE.eu, has announced the availability of new hosting plans that are optimized for the latest update of the Sitefinity 7.3 hosting technology.

HostForLIFE.eu supports Sitefinity 7.3 hosting on our latest Windows Server and this service is available to all our new and existing customers. Sitefinity 7.3 offers a natural extension to all customer SharePoint workflows and wrap a compelling presentation around client core business documents. Contextual task-oriented approach to organizing documentation on any topic.

HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam, London, Paris 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 Sitefinity 7.3  site on our environment from as just low €3.00/month only.

Sitefinity 7.3 is a Web Content and Experience Management Platform that enables business to engage, convert and retain customers through multiple channels. Sitefinity 7.3 is the only truly mobile web content management on the market that supports all three mobile strategies out of the box – responsive design, mobile apps and mobile sites.

Sitefinity 7.3’s intuitive user interface delights both developers and business users alike, making it a more efficient environment to get more work done faster. There’s no long training required, so even new non-technical users will be up and running in no time. Because it’s built on a modern code-base, Sitefinity is best equipped to meet the long term needs of today’s expanding businesses, including tackling challenges like mobile, ecommerce, multisite management, content personalization, and so much more.

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 Sitefinity 7.3 performance.

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

About HostForLIFE.eu :
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 Server 2014 Hosting Belgium - HostForLIFE.eu :: Backup Verification Script on SQL Server

clock January 22, 2015 05:22 by author Peter

In this post, I will explain you about a script to verification on SQL Server 2014. There are situations wherever you have got to verify the multiple SQL Server instances backup within limited timeframe whether or not it meet your organization backup criteria standards or not.

You can execute below T-SQL script to see the backup status as per your organization normal by assignment backup conditions value to backup criteria variable. You'll execute below script either by connecting every SQL Server Instance or execute it by registering all the SQL Server Instances in Central Management Server (CMS).

Below T-SQL Script work with all the versions of MSSQL Server and verify FULL, Differential and transaction Log Backup. It'll check the max backup date and appraise result based on condition as backup is Passed or Not.

And this is the Backup Verification Script and it will return below values:

  • SQLInstanceName
  • DatabaseName
  • db_create_ddate
  • DB_Recovery_Model
  • dbstatus
  • windowsservername
  • productversion
  • productlevel
  • edition
  • current_datetime
  • last_full_backup_date
  • last_diff_backup_date
  • last_tran_backup_date
  • days_since_last_full_backup
  • days_since_last_diff_backup
  • hours_since_last_tranlog_backup
  • Full_Backup_Stauts
  • Diff_Backup_Stauts
  • Log_Backup_Stauts
  • full_backup_location
  • diff_backup_location
  • tlog_backup_location

You have to specify the backup condition based on your organization standard by assigning values to below variables.
declare @full_backup_criteria_in_days int
declare @diff_backup_criteria_in_days int
declare @log_backup_criteria_in_hours int
 -- specify the backup criteria
set @full_backup_criteria_in_days = 7 -- 7 day older Full Backup is Pass
set @diff_backup_criteria_in_days = 1 -- 1 day older Diff Backup is Pass
set @log_backup_criteria_in_hours = 2 -- 2 hours older Log Backup is Pass

This is the complete script that I used:
declare @full_backup_criteria_in_days int
declare @diff_backup_criteria_in_days int
declare @log_backup_criteria_in_hours int
-- specify the backup criteria
set @full_backup_criteria_in_days = 7 -- 7 day older Full Backup is Pass
set @diff_backup_criteria_in_days = 1 -- 1 day older Diff Backup is Pass
set @log_backup_criteria_in_hours = 2 -- 2 hours older Log Backup is Pass
select   
           serverproperty('servername') as SQLInstanceName,
           quotename(bkup_full.[database_name]) as DatabaseName,
            ( select    sdb.crdate
              from      [master]..[sysdatabases] sdb
              where     sdb.name = bkup_full.[database_name]
            ) as [db_create_ddate],         
           databasepropertyex(bkup_full.[database_name],'recovery')  as DB_Recovery_Model,
           databasepropertyex(bkup_full.[database_name],'status')  as dbstatus,     
           case serverproperty('isclustered')
                        when 1 then cast(serverproperty('computernamephysicalnetbios') as varchar)
                        when 0 then cast(serverproperty('machinename') as varchar)
           end as windowsservername,
           serverproperty('productversion') as productversion,
           serverproperty('productlevel') as productlevel,
           serverproperty('edition') as edition,
            current_timestamp as current_datetime,           
           bkup_full.[backup_finish_date] as [last_full_backup_date],         
           bkup_diff.[backup_finish_date] as [last_diff_backup_date] ,
           bkup_log.[backup_finish_date] as [last_tran_backup_date] ,
           datediff(dd, bkup_full.[backup_finish_date], current_timestamp) as [days_since_last_full_backup] ,
           datediff(dd, bkup_diff.[backup_finish_date], current_timestamp) as [days_since_last_diff_backup] ,
           datediff(hh, bkup_log.[backup_finish_date], current_timestamp) as [hours_since_last_tranlog_backup] ,            
           case
                        when datediff(dd, bkup_full.[backup_finish_date], current_timestamp) <= @full_backup_criteria_in_days
                        then 'Pass'
                        else 'Fail'
                        end as Full_Backup_Stauts,            
            case
                        when datediff(dd, bkup_diff.[backup_finish_date], current_timestamp) <= @diff_backup_criteria_in_days  then 'Pass'
                        else case when quotename(bkup_full.[database_name]) IN ('[master]') then 'N/A' else 'Fail' end                      
                        end as Diff_Backup_Stauts,
            case
                        when datediff(hh, bkup_log.[backup_finish_date], current_timestamp) <= @log_backup_criteria_in_hours  then 'Pass'
                        else case when databasepropertyex(bkup_full.[database_name],'recovery') = 'SIMPLE' then 'N/A' else 'Fail' end                      
            end as Log_Backup_Stauts,          
             ( select top 1 [physical_device_name]
              from      [msdb]..[backupmediafamily] bkup_media_family
              where     bkup_media_family.[media_set_id] = bkup_full.[media_set_id]
            ) as [full_backup_location] ,
            ( select top 1  [physical_device_name]
              from      [msdb]..[backupmediafamily] bkup_media_family
              where     bkup_media_family.[media_set_id] = bkup_diff.[media_set_id]
            ) as [diff_backup_location] ,
            ( select top 1  [physical_device_name]
              from      [msdb]..[backupmediafamily] bkup_media_family
              where     bkup_media_family.[media_set_id] = bkup_log.[media_set_id]
            ) as [tlog_backup_location]                                       
    from    [msdb]..[backupset] as bkup_full
            left join [msdb]..[backupset] as bkup_log on bkup_log.[database_name] = bkup_full.[database_name]
               and bkup_log.[server_name] = bkup_full.[server_name]
               and bkup_log.[type] = N'L'
               and bkup_log.[backup_finish_date] = ( (select  max([backup_finish_date])
               from    [msdb]..[backupset] b2  where   b2.[database_name] = bkup_full.[database_name]                                                                                                    and b2.[server_name] = bkup_full.[server_name]                                                                                                    and b2.[type] = N'L') )
            left join [msdb]..[backupset] as bkup_diff on bkup_diff.[database_name] = bkup_full.[database_name]
               and bkup_diff.[server_name] = bkup_full.[server_name]                                                     
               and bkup_diff.[type] = N'I'
               and bkup_diff.[backup_finish_date] = ( (select max([backup_finish_date])
                 from    [msdb]..[backupset] b2
                 where   b2.[database_name] = bkup_full.[database_name]
                 and b2.[server_name] = bkup_full.[server_name]
                 and b2.[type] = N'I') )
                 where   bkup_full.[type] = N'D'
                and bkup_full.[backup_finish_date] = ( (select  max([backup_finish_date])
                       from   [msdb]..[backupset] b2
                       where  b2.[database_name] = bkup_full.[database_name]
                       and b2.[server_name] = bkup_full.[server_name]
                                                        and b2.[type] = N'D') )
            and exists ( select [name]
                         from   [master]..[sysdatabases]
                         where  [name] = bkup_full.[database_name] )
            and bkup_full.[database_name] <> N'tempdb'

HostForLIFE.eu SQL Server 2014 Hosting
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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



SQL Server 2014 Hosting Germany - HostForLIFE.eu :: How to List All Tables of a Linked Server's Database ?

clock January 20, 2015 05:04 by author Peter

There are numerous situations in the DBMSs  world where you may need to utilize a connected server between two diverse SQL Server 2014 cases with a specific end goal to execute immediate queries between them. In any case, the majority of T-SQL auto-complete tools experience issues to rundown the items (i.e. tables) of the connected server's database.

An approach to see these items, is to browse via SSMS's Object Explorer. Shouldn't we think about however in the event that you need to have a quick view of all the accessible tables in the connected server's database while composing your T-SQL script?

The answer is simple! You can do this by utilizing the Information Schema Views. Underneath you will discover a pstored procedure that I made which can help you to list  all the tables of linked server's database. And here is the code:
------------------------------------------------------------------------------------------
-- Sample Code for Blog Post: Listing all Tables of a Linked Server's Database
-- Disclaimer: This is a sample code. Do not use it in Production Systems before properly
-- Testing it. You bear sole responsibility for usage of any content of this T-SQL code.
-- You are responsible for any loss of data, loss of peace or any damages due to usage of this code. Always take backup of your data.
------------------------------------------------------------------------------------------
USE [ENTER_DATABASE_NAME];
GO
CREATE PROCEDURE [dbo].[DBTableInfo] (@LinkedServerName varchar(50), @DBName varchar(50))
AS
--variables declaration
DECLARE @LinkedServerNameFiltered VARCHAR(50)
DECLARE @LinkedServerNameFound int
DECLARE @DBsFound int
DECLARE @DBNameFiltered varchar(50)
DECLARE @Command nvarchar(500)
--check if specified linked server exists
SET @LinkedServerNameFiltered=QUOTENAME(@LinkedServerName);
SET @LinkedServerNameFound=0;
SET @LinkedServerNameFound=(SELECT COUNT(*) FROM sys.servers s WHERE [email protected]);
--report findings
IF @LinkedServerNameFound=0
BEGIN
PRINT 'Error: Linked server ' + @LinkedServerNameFiltered+ ' not found.';
RETURN;
END
--check if specified database exists
DECLARE @QUERY nvarchar(250);
SET @DBNameFiltered = QUOTENAME(@DBName,'''');
SET @DBsFound=0;
SET @QUERY='(SELECT @DBs=COUNT(*) FROM ' + @LinkedServerNameFiltered +'.[master].sys.sysdatabases s WHERE s.name='[email protected]+')';
EXEC sp_executesql @QUERY, N'@DBs int OUTPUT', @[email protected] OUTPUT;
--report findings
IF @DBsFound=0
BEGIN
PRINT 'Error: Database ' + @DBNameFiltered + ' not found.';
RETURN;
END
--construct dynamic T-SQL statement
SET @DBNameFiltered = QUOTENAME(@DBName);
SET @LinkedServerNameFiltered=QUOTENAME(@LinkedServerName);
SET @Command= 'SELECT TABLE_SCHEMA as TableSchema, TABLE_NAME as TableName,(''SELECT TOP 10 * FROM '+ @LinkedServerNameFiltered +'.'+ @DBNameFiltered +'.'' + QUOTENAME(TABLE_SCHEMA) + ''.'' + QUOTENAME(TABLE_NAME)) as SampleQuery
FROM ' + @LinkedServerNameFiltered+'.' + @DBNameFiltered+'.INFORMATION_SCHEMA.TABLES i WHERE i.TABLE_TYPE LIKE ''%TABLE%'' ORDER BY 1';
--execute the command
EXEC sp_executesql @command;
------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------

You can call the stored procedure as follows:
USE [ENTER_DATABASE_NAME];
GO
EXEC [dbo].[DBTableInfo] 'LINKED_SERVER_NAME', 'LINKED_SERVER_DB'
GO


The stored procedure shows three columns for each each record:(i) Table Schema, (ii) Table Name, (iii) A sample question that can be executed and gives back where the top 10 rows for the specific table.. And here is the output:

HostForLIFE.eu SQL Server 2014 Hosting
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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



Node.js Hosting UK - HostForLIFE.eu :: Creating HTTPS Server With Node.js

clock January 15, 2015 07:04 by author Peter

HTTP server was ok for us to try and do numerous operations that we've performed within the articles lately. During this specific article however, we are going to be looking at a way to create HTTPS server instead with Node.js.

We use HTTPS after we would like secure sessions. A secure session implies that the online browser can encrypt everything you are doing with a digitally signed certificate. Therefore clearly before you are doing HTTPS, you would like to make certificates. Let's therefore spend a while to check a way to develop certificates for SSL.

Make a SSL Certificates
In order to make a certificate, you need to download a small tool OpenSSL first from this link https://code.google.com/p/openssl-for-windows/downloads/list

Download the version as per your system's specification, it's essentially a zip file. Once downloaded, extract the content to a such location onto your disc drive. Now open the location of the extracted content and copy the file openssl.cnf to the bin folder.

That is the configuration file for the Openssl. Next, open CMD, change the directory to this folder and execute the following code.

openssl req -config openssl.cnf -x509 -days 365 -newkey rsa:1024 -keyout hostkey.pem -nodes -out hostcert.pem

The program can then a few you for a few peices of data for creating the certificate. in the end of everything, you may have 2 files hostcert.pem and hostkey.pem, that is our certificate and key file respectively, that we are going to be using in our HTTPS server.

Creating HTTPS server
Just like we have a tendency to do for HTTP, an import to node's HTTP module, for HTTPS we import the HTTPS module. Also, since we'd like to pass within the certificate and key file, we also need to import the filestream (fs) module to enable Node to read the files. the following is that the code to make the HTTPS server.
var https = require('https'); 
var fs = require('fs'); 
   var options = { 
  key: fs.readFileSync('hostkey.pem'), 
  cert: fs.readFileSync('hostcert.pem') 
}; 
https.createServer(options, function (req, res) { 
 res.writeHead(200); 
  res.end("hello world\n"); 
}).listen(8000); 


Of course you wish to copy the files into the same location because the node program. now if you explore the code above, you will find that it's very similar to what we discussed before, like reading files, making a http server so on. The change however is that the https.createServer() method that takes another parameter, that is that the certificate and key for the SSL.

Now if you run the code and see it in a browser, this can be how it looks:
Select proceed anyway option as of now, as our browser does not understand our amazing certificate.



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]



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