Thursday, May 25, 2017

Creating a default Full-Text Catalog

A full-text catalog is a logical container where a group of full-text indexes are stored. A full-text catalog is needed before you can create a full-text index. Full-text catalog is a virtual object and does not belong to the file group.

In order to text search an full-text index will be needed. For example, the Categories table in Northwind does not have a full-text indexed column. If you try to create a Full-Text indexed column you will get this error:
-----------
Msg 9967, Level 16, State 1, Line 11
A default full-text catalog does not exist in database 'Northwind' or user does not have permission to perform this action.

--------------

You can create a Full-text catalog using the SQL Server Management Studio or using Transact-SQL(T-SQL)
---------
Here is how it is created for Northwind database in SQL Server 2016 using T-SQL

USE Northwind
Go
Create FULLTEXT CATALOG ftCat_Nwind as default
Go

------
Before the above statement was run there was no Catalog:


After the above statement was processed the named catalog was created:


You can access the properties as shown here

All tables and views are eligible and you can assign the objects to the Catalog by transferring using the > button.

Creating a Full-Text catalog for Northwind using SQL Server Management Studio is easy. Right click Full-Text Catalogs in the Storage node and provide a name for the catalog and a owner. Choose the accent sensitivity and click OK to create.


The Catalog gets created as shown.


Caution:
Although SQL Server 2016 SP1 allows you to create a Full-Text Catalog, you will find it missing in the System Views as in the following query.

This feature has not improved even from the older versions. It has not been fixed and the error messages that you get such as the following does not give a clue.

Property IsAccentSensitive is not available for the Full-Text catalog <catalog name>
Property PopulationStatus is not available for FullTextCatalog <catalog name>

The reason for this error is that the Full-Text feature was not installed in the first place.
Watch the video and review features not installed:

https://hodentekmsss.blogspot.com/2017/05/installing-sql-server-2016-sp1-for.html

TABLOCK hint in an Update SQL Query

TABLOCK is one of several table hints in SQL Server which includes the following:

   FORCESCAN 
   FORCESEEK 
   HOLDLOCK  
   NOLOCK  
   NOWAIT 
   PAGLOCK  
   READCOMMITTED  
   READCOMMITTEDLOCK  
   READPAST  
   READUNCOMMITTED  
   REPEATABLEREAD  
   ROWLOCK  
   SERIALIZABLE  
   SNAPSHOT  
   SPATIAL_WINDOW_MAX_CELLS = integer 
   TABLOCK  
   TABLOCKX  
   UPDLOCK  
   XLOCK 

Table hints can be used with any of the following operations:
Applies to:
DELETE
INSERT
SELECT
UPDATE
MERGE

Here is a query that updates a value in the Northwind Shippers table:
----------
Use Northwind
GO
UPDATE  Shippers
WITH (TABLOCK)
SET CompanyName='Speedy Gonsalez'
WHERE ShipperID=1

--
SELECT * from Shippers
------------
The query updates the name of the shipping company whose ID=1 to a new name. When TABLOCK is used in the above manner it should be within the parenthesis.


Read this recommendation from Microsoft:

"An UPDATE statement always acquires an exclusive (X) lock on the table it modifies, and holds that lock until the transaction completes. With an exclusive lock, no other transactions can modify data. You can specify table hints to override this default behavior for the duration of the UPDATE statement by specifying another locking method, however, we recommend that hints be used only as a last resort by experienced developers and database administrators"


Wednesday, May 24, 2017

Installing SQL Server 2016 SP1 for Native Mode Reporting Services Course


This video presentation was prepared for the course to fast track teach Report authoring using Report Builder 3. The Reporting Services is installed for Native Mode.




Conversion of Power Point Slides to Video seems to have some problems. My apologies...

This is easier to watch:
https://youtu.be/qp6IF_rAi80

Monday, May 22, 2017

Error Msg 103, Level 15, State 4

The following is formatted in JSON

["wclass",
{"student":{"name":"Linda Jones","legacySkill":"Access, VB 5.0"}etc..
},
{  "student":{"name":"Adam Davidson","legacySkill":"Cobol, MainFrame"}
},
{"student":{"name":"Charles Boyer","legacySkill":"HTML, XML"}
}]

This is a valid JSON according to RFC 4627.


json_01

However when you use this in SQL Server to look at the JSON using the OpenJSON, for example, you will get this error:


json_00

The reason for this error:

Msg 103, Level 15, State 4, Line 2
The identifier that starts with "wclass"...

lies in the fact that SQL Server string starts with a single quote and therefore you need to provide this declaration:

declare @json nvarchar(Max)
set @json=
'["wclass",
{"student":{"name":"Linda Jones","legacySkill":"Access, VB 5.0"}
},
{"student":{"name":"Adam Davidson","legacySkill":"Cobol, MainFrame"}
},
{"student":{"name":"Charles Boyer","legacySkill":"HTML, XML"}
}]'


When you do this the error goes away as shown:


json_02


The character count in @json is also important as you see in this SQL query:


json_03

The answer is that RFC 4627 validation requires a string to start with a double quote("), but the SQL Server's JSON validation requires the JSON to begin with a single quote(') as we saw in this post.

Sunday, May 21, 2017

SELECT query on OpenJSON using SQL Server 2016


OpenJSON converts an array of objects in a variable in JSON Format to a rowset
that can be queried with standard SQL Select statement.

Here is an example:

We are going to look at a JSON list of my first batch of students who took my course shown here. 

["wclass",
{"student":{"name":"Linda Jones","legacySkill":"Access, VB 5.0"}
},
{"student":{"name":"Adam Davidson","legacySkill":"Cobol, MainFrame"}
},
{"student":{"name":"Charles Boyer","legacySkill":"HTML, XML"}
}]

This is the result of running OpenJSON using the above:



Now you can run a SELECT query with a with clause on the rows returned by OpenJSON as shown here:

The first member "wclass" has nulls for the selected columns. It exists because it actually was in the original XML that got converted to JSON.
Here are my more recent JSON related articles:

JSON validation in SQL Server:
https://hodentekmsss.blogspot.com/2016/11/using-json-validator-in-sql-server.html

Nested JSON using SQL Server 2012:
https://hodentekmsss.blogspot.com/search?q=json

Retrieve JSON formatted data from SQL Anywhere 17
https://hodentekmsss.blogspot.com/2016/11/retrieve-data-from-sql-anywhere-17-in.html

Tuesday, May 16, 2017

Globally distributed Azure Cosmos DB

This is how Azure Cosmos DB is described by Microsoft,

"Azure Cosmos DB is Microsoft's globally distributed, multi-model database. With the click of a button, Azure Cosmos DB enables you to elastically and independently scale throughput and storage across any number of Azure's geographic regions. It offers throughput, latency, availability, and consistency guarantees with comprehensive service level agreements (SLAs), something no other database service can offer"

If you are looking for Global Distribution, horizontal scaling, guaranteed latency, high availability, comprehensive SLA's and unrivalled Data Model and APIs that no RDBMS, no no-sql database can provide, there is nothing out there to match Azure Cosmos DB.



Azure Cosmos DB Engine supports multiple database systems and it is based on the following:

 Atom: Consisting of a small set of primitive types (String, Bol, number)
 Records: Structs
 Sequence: Arrays of atoms, records and sequences

Azure Cosmos DB engine currently supports the following:

Document DB SQL
Mongo DB
Azure Table Storage
Gremlin Graphh Query API
It will support other API's in the future.

For developers looking for a globally distributed database system Azure Cosmos DB is the answer.

Saturday, May 13, 2017

Building an ODBC Connection String in Report Builder 3 for SQL Server 2016

ODBC source is one of the many sources that you can connect to in Reporting
Services using the Report Builder.

Here are the steps. It is assumed you have SQL Server 2016 SP1 installed; Report Builder is also
installed on the same machine. For these steps it is assumed that the SQL Server is up and running
and you are the owner of the computer who installed the SQL Server.

1. Launch Report Builder with Administrative Privileges.
2. Right click Data Sources and Click Add DataSource... to bring up the Data Source properties window.
3.  Provide a name for the data source, DS_ODBC
4. Choose Use a connection embedded in my report
5. Select connection type: click handle and choose ODBC at the bottom of list
6. Click Build... to bring up the Connection properties window
7. In the Data source specification section choose Use connection string:
8. Click the Build... button that gets activated to display Select Data Source window
9. Click Machine Data Source
10. In Machine Data Source tabbed page, click New... to display Create New Data Source
11. Accept the default, User Data Source and click Next
12. In the Select a driver for which you want to set up a data source, scroll down and
    select SQL Server (SQLSRV32.dll); click Next to display the next window
13  Click Finish. Create a New Data Source to SQL Server is displayed
14. Provide a name of your choice (ODBC_DSN); Description:(ODBC for Report Builder); Server
    use handle to locate: Hodentek9\OHANA. Click Next
15. Accept the default in the displayed page: with Windows NT authentication using the
    Network login id. Click Next
16. Change the default database by clicking handle to Northwind. accept all other
    defaults. Click Next
17. Accept all defaults on the displayed page. Click Finish
18. In the ODBC Microsoft SQL Server Setup page test the connection and make sure it works. Click OK
19. ODBC_DSN enters the Machine Data Source tabbed page. Click OK
20. SQL Server Login window gets displayed. Enter creator owner's credentials
21. Copy the connection string from the connection properties window.
Dsn=ODBC_DSN;description=ODBC for Report Builder;trusted_connection=Yes;app=Microsoft SQL Server;wsid=HODENTEK9;network=DBNMPNTW
22. Test Connection to make sure it works
23. Click OK
The Connection string enters the Data Source Properties window as shown.






Thursday, May 11, 2017

Report Model managment is discontinued in Reporting Services Web Portal

RS Web Portal is the new name for Report Manager of earlier versions.

The following two features related to Report Model are discontinued  in SQL Server 2016.
Whereas HTML4 is supported, the future SQL Server Reporting Services will be using HTML5.

Feature                                                                Replacement or workaround
Upload report models through the web portal     This can still be done through the SOAP API.
Manage report models through the web portal    This can still be done through the SOAP API.

However the Report Model is still retained in couple of places, for example the Window for selecting permissions for a Custom Role.

Branding a Reporting Services Web Portal

Branding is an important feature of a Reporting Service Web Portal to drive business. It should be very attractivewith a nice logo; colors and features that should be able to choose how you present it.
This will be true for mobile reports as well. Microsoft has provided ample guidance as to how you go about branding your reporting site.




Brand Package consists of

a zip file with 3 named files:

color.json, metadata.xml,

and logo.png

Wednesday, May 10, 2017

Fix for the rsErrorOpeningConnection in SSRS 2016

The error, rsErrorOpeningConnection has been asked many times in almost
all versions of SQL Server Reporting Services starting from SSRS 2008. Various
reasons have been given. The error message hints at what may be wrong.

In the present case, a simple report with embedded data source  was created in Report Builder 3 by the creator owner who is also the local administrator. This report was saved to the
Report Server (also gets uploaded to the Web Portal front-end).


The report is processed in the Report Builder without any error.

If the Where_2 report is double clicked this is the message displayed after correct authentication
by the local administrator.



The Data Source is shown in the following and the report gets correctly displayed in
the Report Builder and it can be saved to the Report Server as seen above.

The rsErrorOpeningConnection arises because of the credentials to the Data Source is not
properly configured (what is shown is the default). Review the credentials for the data source:


When you make the proper entries for the report as shown here:


The error goes away.

 The SQL Server 2016 SP1, the Report Builder 3 are both on a Dell Laptop with Windows 10 Pro. The Reporting Services configuration is for Native Mode managed by the laptop owner.







Wednesday, May 3, 2017

Hands-on training event in Honolulu: SQL Server Reporting Services 2012 in Native Mode



Updated information: SQL Server 2016 SP1 will be used

This hands-on course will provide you with the ability to create cutting edge reports using Microsoft's latest reporting services product, SQL Server 2012.
The course is offered by the Pacific Center for Advanced Technology Training(PACTT): http://pcatt.hawaii.edu/home
Report writing is one of the most important IT related jobs in an enterprise. This course is for you if you would like to master report writing/authoring using SQL Server Reporting Services. The course begins with a presentation of essential technical background, after which you will work through guided hands-on exercises.
At the end of the course you will have gained:
• A solid understanding of how to interact with SQL Servers
• Knowledge and experience installing and configuring reporting Services
• A working knowledge of using Report Builder to author reports and deploy them to report server
• A working knowledge of Report Manager's ability to carry out administrative tasks related to all aspects of reports; creating shared data sources, folder and folder hierarchies on the report server, and report models; managing security and subscriptions; and configuring data driven subscriptions
• An understanding of how to embed report viewer controls in windows and web projects.


Venue: Honolulu Community College Honolulu Community College
874 Dillingham Blvd Honolulu, HI 96817-4598

Phone: (808) 845-9211

Official Website: honolulu.hawaii.edu/

Recommended Prep:
Computer literacy on a PC and experience using a database
- Section 1 - May 18 - Jun 27; TTh; 5:30 pm - 7:30 pm; 12 mtgs

Tuesday, May 2, 2017

SQL Server Management Studio for SQL Server 2016 is a separate Install

Recently downloaded SQL Server 2016 SP1 and to my surprise I did not find SQL Server Management Studio. This is by design that Microsoft wants user to download it separately, it is free however. In addition to SSMS (v17.0) lots of other components related to SQL Server vNext CTP 2.0 are also installed.

Another surprise, SQL Server 2016 SP1 now installs the SQL Server Configuration Manager.

How's that for confusion!


Install SSMS (Release 17) from this link:
https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms

 SQL Server 2016 SP1 installation installs the following:




SQL Server Management Studio installs the following shown by arrows:


















I am not paying this invoice. I am disregarding it, becuase....

 I am not paying this invoice because MICROSOFT has not provided me with a satisfactory way to access my account since June of this year des...