-->
SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Si vis pacem, para sql

Developer, Administrator and Architect with 10+ years of expertise in data analysis, design, programming, performance tuning, upgrades, migrations, high availability solutions implementation, backup & recovery strategies and database capacity planning expertise.

Using Time Zones in SQL Server

The usage of time zones in applications becomes inevitable, especially with the globalization of the applications. Reports need to be run in different time zones. Services have to consider the time zones. Applications’ users nowadays, which are around the globe use their local zones and etc.

The programming on database… Read more

2 comments, 1,457 reads

Posted in Si vis pacem, para sql on 18 August 2017

RegEx in SQL Server for replacing text

In this post I’m presenting usage of two functions that use Regex. My previous post was about searching text in SQL Server using regex, and now I’m showing how to use it for replacing text in SQL Server.

The two new functions added to the SqlRegex.dll are RgxTrim() and… Read more

0 comments, 382 reads

Posted in Si vis pacem, para sql on 1 August 2017

RegEx in SQL Server for searching text

As a database developer or DBA, or even software developer, you must have met up with the difficulties of finding some strings/sub-strings in the text columns. In such situations we usually make two or more of queries in order to cover the various cases, or even don’t try it because… Read more

0 comments, 299 reads

Posted in Si vis pacem, para sql on 24 July 2017

Microsoft Certified Trainer!

For the first time in my career, I’m a Microsoft Certified Trainer (MCT). This title came as a result of my two-year working as a trainer at the Seavus Educational and Development Center (SEDC), so I’m very thankful to SEDC.

I teach several subjects related to SQL Server… Read more

0 comments, 232 reads

Posted in Si vis pacem, para sql on 28 May 2017

Some stuff with Date and Time in SQL Server

I’m writing this post because I want to put some more stuff around dates and times in one place. I additionally teach SQL Server classes and often come up to talk about dates and times, and converting them to string representations. Of course I don’t always have time enough to… Read more

0 comments, 424 reads

Posted in Si vis pacem, para sql on 9 May 2017

Multiple usage of functions to ensure “value” is not null?!

In this post I’m describing a piece of code that is not well written. The author (unknown) had applied three functions for a variable to ensure it never accepts NULLs. The code is given in the next screen shot.

ScreenShot 1. The query with three functions on OriginalAmount

As you… Read more

7 comments, 1,937 reads

Posted in Si vis pacem, para sql on 29 April 2017

Mixed page allocation

MIXED_PAGE_ALLOCATION is a new option introduced with SQL Server 2016. It controls whether the database can create initial pages using a mixed extent for the first eight pages of a table or index. There is a bit column in the sys.databases view with values:

  • OFF -The database always creates initial pages…

Read more

0 comments, 337 reads

Posted in Si vis pacem, para sql on 8 April 2017

A rare Reporting services issue

This post is about a reporting services configuration issue that you will face after changing the database server name. I’ve blogged about Changing SQL Server name and warned on issues with SSRS.

After making a change of the server name, a period later when I run my Report manager I was… Read more

0 comments, 78 reads

Posted in Si vis pacem, para sql on 10 March 2017

INPUT and OUTPUT type parameters in stored procedures

Output-only parameters do not exist in the T-SQL procedures. They are all either input-only or input/output.

The OUTPUT keyword in the procedure’s definition or its invocation, designates the input/output type of a parameter.

The shorten CREATE syntax for stored procedure is the following

CREATE { PROC | PROCEDURE }   procedure_name Read more

0 comments, 84 reads

Posted in Si vis pacem, para sql on 7 March 2017

Database cloning – CLONEDATABASE

Database cloning is a new feature supported in SQL Server. Only SQL Server 2014 SP2 and SQL Server 2016 SP1 support cloning.

The command syntax is very simple

DBCC CLONEDATABASE (source_database_name, target_database_name)

For example the next command

DBCC CLONEDATABASE (AdventureWorks2014, AdventureWorks2014_Clone)

will create database AdventureWorks2014_Clone with files created in the… Read more

0 comments, 169 reads

Posted in Si vis pacem, para sql on 27 February 2017

SQL and the other technologies

I was curious about how the SQL language stands with the other technologies. Next table shows it. The data is taken from StackOverflow.

2013201420152016
JavaScript56.6%58.9%54.4%85.3%
SQL59.6%57.1%48.0%58.9%
C#44.7%37.6%31.6%35.3%
Java42.5%37.6%31.6%35.3%
PHP34.8%

Read more

0 comments, 151 reads

Posted in Si vis pacem, para sql on 31 January 2017

SCOPE_IDENTITY() or @@IDENTITY

I’ve seen quite a lot of usage of both functions in the T-SQL codes. However, their usage sometimes matters. The expectation from @@IDENTITY can sometimes not be the desired.

This post shows why you should use SCOPE_IDENTITY() instead of @@IDENTITY when using it with tables that have triggers.

CREATE DATABASE IdentDB;
GO…

Read more

0 comments, 59 reads

Posted in Si vis pacem, para sql on 27 January 2017

My first Microsoft MVP Award!

Exactly 10 years ago I started my career as a Software developer in a Bank, which for me meant directing my career in the fields of data analysis, processing and data architecture. Fortunately all my next jobs were/are strongly related with data, and today I’m a proud and dedicated database… Read more

0 comments, 51 reads

Posted in Si vis pacem, para sql on 10 January 2017

Indexes optimize for the system databases

Maintenance of the system databases in SQL Server regarding the indexes is important. The system tables also have indexes and their maintenance is of asset on the busy environments.

It’s also important to know that the indexes in msdb and master are marked as system objects, so if you have… Read more

0 comments, 57 reads

Posted in Si vis pacem, para sql on 23 December 2016

SQL Server and Hyper-threading

This post is about the CPU utilisation in the Standard, Web and Express editions of SQL Server because there is limitation for them. Licensing is given at the end of this post.

Physical environments

According to the official msdn references ([1], [2], [3]), Table… Read more

0 comments, 76 reads

Posted in Si vis pacem, para sql on 20 December 2016

CPU Spikes Caused by Periodic Scheduled Jobs

In this article I’ll show you how to eliminate periodic spikes in the CPU that are caused by the jobs that execute periodically. Figure 1 shows such a situation. You can see the spikes occurring every minute.

Figure 1. CPU spikes caused by periodic-scheduled jobs

There is a good reason… Read more

0 comments, 48 reads

Posted in Si vis pacem, para sql on 1 December 2016

What does an Index mean to a Query

This post is about the importance of a right index to a query. The following simple query was considered.

SELECT
    [GroupBy1].[A1] AS [C1]
    FROM ( SELECT
        MAX([Extent1].[CreatedDate]) AS [A1]
        FROM [dbo].[GeoIP2Location] AS [Extent1] WITH (NOLOCK)
    )  AS [GroupBy1]

Even simple, this query was causing troubles on our production systems. The query… Read more

0 comments, 56 reads

Posted in Si vis pacem, para sql on 11 November 2016

Connect to SQL Azure database from SSMS

In this article I’ll show you how to connect to SQL Azure database instance and create a simple database. First you have to own an Azure account. In the account you have to have a resource (your database server).

Some of the details from your resource can be used for filling up… Read more

0 comments, 84 reads

Posted in Si vis pacem, para sql on 11 October 2016

Changing SQL Server name

This post is about how to rename a stand-alone SQL server instance. There could be some reasons to do that: You simply forgot to change the name of your Sysprep server or You want to change from the default instance name to another and etc.

The dynamic view sys.servers enables… Read more

0 comments, 93 reads

Posted in Si vis pacem, para sql on 2 October 2016

Be a good administrator

Below are the topics every Administrator has to keep up with.

Backup / Restore:

  • Understand the backup / restore options SQL Server provides for you.

  • Implement those on your databases to meet your users’ needs.

  • Test those backups regularly to make sure they are good and to give you an…

Read more

0 comments, 59 reads

Posted in Si vis pacem, para sql on 19 September 2016

Older posts