Posts Tagged ‘ SQL ’

How to Convert Julian Date to Gregorian in MS SQL

2017/09/20
By
Modified: 2017/09/16
SQL - Convert JUL to GREG

Julian date is stored in YYYDDD format, for example 12/31/99 will be stored as 99365 and 01/01/2017 will be stored as 117001. If you need to convert the date from YYYDDD to any conventional date format like dd/mm/yyyy in SQL use steps below. The idea is to convert year and date portions separately and them add them together and use CONVERT function to get any date format that you require. Here is a script that shows the conversion process step-by-step. SELECT -- Limit output for 9 rows TOP 9 -- 00 Julian date - 91244 FAEFTB, -- 01 Greg year - 1991 cast(left(CAST(FAEFTB as decimal)+1900000, 4) as char(4)) AS GREGYEAR, --…

Read more »


Adding a new WordPress site to an Existing Installation

2017/07/12
By
Modified: 2017/06/25

Task You already have a working WordPress (WP) site.  Now, you need to add one more site with a new MySQL database.  This document describes how to add one more database and install a new WP site on the same server. Download Download latest WordPress ZIP package (3.X) and unzip it to your future site location. Open IIS Admin Create a new virtual directory pointing to that location Side Notes – Change root password You need to know existing root user password. Login into MySQL Command Line Client. Select database: use mysql; Reset user password: update user set password=PASSWORD(“NewPassword”) where User=’root'; Allpy new password: flush privileges;   Create a New Database…

Read more »

Update Field Based on a Field in Another Table

2017/06/02
By
Modified: 2017/04/30

This article contains 3 examples: - T-SQL; – MS Access; – AS/400.   This example shows a standard T-SQL syntax tested on MS SQL 2005 server: update P set P.CertMemberLevelID = Z.CertLevelTo from   UPM_MemberPermissionMask P INNER JOIN zzzCertRegistryUpdate Z ON P.MemberID = Z. Cert2ID Here we are updating one filed CertMemberLevelID in table UPM_MemberPermissionMask based on field Cert2ID in table zzzCertRegistryUpdate. This next example was generated using MS Access 2007 syntax: UPDATE CRPDTA_F1201 INNER JOIN CatCode7 ON CRPDTA_F1201.FANUMB = CatCode7.XXNUMB SET CRPDTA_F1201.FAFA7 = [CatCode7].[XXFA7] A field FAFA7 in CRPDTA_F1201 is being updated. Table  CatCode7 contains 2 fields: – ID Link field XXNUMB and – Update values field XXFA7 SQL statement JOINs two…

Read more »

How to Get SQL Table Field Structure?

2017/05/15
By
Modified: 2017/04/30
SQL-2008-R2

Sometimes you need to display or print a SQL table structure. This article provides a SQL statement that allows you to do that. We are using MS SQL 2008 Studio interface.

Read more »

Move WordPress to a new Windows Server 2012 on Amazon AWS

2017/05/11
By
Modified: 2017/04/30
Move WordPress to a new Windows Server 2012 on Amazon AWS

This article is about moving your Windows-based WordPress and other sites (some ASP, some ASP.NET) from older to a newer instance using AMAZON cloud server  instances.  Procedures described here do not involve any installation.  Just copy files and edit CONFIG files.  We do not manipulate Registry as well (except to change inbound RDP port). Sample installation in this article was tested on Amazon Small instance.  Image used  was Windows 2012 Server x64 with SQL Server2012 Express.  This article can be used to create you own check list while preparing to migrate to a new Amazon server. Why would you decide to upgrade or move to a new instance/server?  Here are some driving reasons:  Something is no…

Read more »

Add a FILESTREAM feature to an existing SQL D/B

2017/05/07
By
Modified: 2017/04/30
SQL 2008 SP2 FILESTREAM Problem

SQL Server 2008 allows to store binary data, if Database has a FILESTREAM feature

Read more »

Moving Old ASP Sites to 2008 Server, IIS 7, and SQL 2008

2017/04/13
By
Modified: 2017/03/03
Moving Old ASP Sites to 2008 Server, IIS 7, and SQL 2008

It was time to move many sites from W2K3 Server (Windows 2003 Server) and SQL 2000 Server to a new W2K8 Server (Windows 2008 Server) and SQL 2008 Server.  And if I ever have to do it again, I will check with these notes. The greatest secret in technical life (and may be wider) is to change before you have to.  Anticipate and change before circumstances force you.  For a long time I was planning this migration, but I didn’t expect to go through so many hurdles and error messages.  Luckily, I found solutions that seem logical and clean.  So, let’s go into step-by-step details. COPY DATABASE AND SITES – Backup…

Read more »