Saturday, January 12, 2019

How to generate calendar in SQL Server?

How to generate calendar dates between two given dates.

This post will show the query to create calendar table.

CREATE TABLE CALENDAR(VDATE DATE)

DECLARE @MinDate DATE = '20181010',
        @MaxDate DATE = '20191010';

INSERT INTO CALENDAR
SELECT  TOP (DATEDIFF(DAY, @MinDate, @MaxDate) + 1)
        Date = DATEADD(DAY, ROW_NUMBER() OVER(ORDER BY a.object_id) - 1, @MinDate)
FROM    sys.all_objects a
        CROSS JOIN sys.all_objects b;



Tags: Generate dates between two dates ; calendar dates sql server ;sql calendar ; all dates;

Wednesday, May 30, 2018

Error in rJava::.jcall(driver@jdrv, "Ljava/sql/Connection;", "connect", : java.sql.SQLException: Network error IOException: Connection refused: connect



Error in rJava::.jcall(driver@jdrv, "Ljava/sql/Connection;", "connect", :

java.sql.SQLException: Network error IOException: Connection refused: connect



Why do I get java.sql.SQLException: "Network error IOException: Connection refused: connect" when trying to get a connection?

The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:
The server name is misspelled or the port number is incorrect.
SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).
There is a firewall blocking port 1433 on the server.

To check whether TCP/IP is enabled and the port is not blocked you can use "telnet <server_host> 1433". Until telnet doesn't connect, jTDS won't either. If you can't figure out why, ask your network administrator for help.

Friday, September 08, 2017

Wake up and Learn Big Data




Wake up and Learn BIG DATA:


I am going to start a tutorial series on big data for the SQL developers. This is the time you should learn big data and start improving your skills parallel to survive in current market scenario.


In this tutorial, I will be guide you through apache Hadoop installation, development and other big data technologies.


In current scenario, the companies are considering new technologies for their new solutions which will create new jobs so you need to consider these learnings for you profile improvement.


Course content:


1. What is big data:


2. Why Big Data is required.


3. Different big data technologies.


4. Back ground of apache Hadoop.


5. Prerequisite for installing Apache Hadoop.


6. Installing ubuntu with dual boot system.


7. Understanding basis architecture of Apache Hadoop.


8. Setting up machine for Hadoop.


9. Hadoop single node cluster installation.

Thursday, June 01, 2017

What are the types of database schema in data warehouse ?

Star Schema:

A star schema is the one in which a central fact table is sourrounded by denormalized dimensional tables. A star schema can be simple or complex. A simple star schema consists of one fact table where as a complex star schema have more than one fact table.



Snow Flake Schema:

A snow flake schema is an enhancement of star schema by adding additional dimensions. Snow flake schema are useful when there are low cardinality attributes in the dimensions.


Galaxy Schema:

Galaxy schema contains many fact tables with some common dimensions (conformed dimensions). This schema is a combination of many data marts.


Fact Constellation Schema:

The dimensions in this schema are segregated into independent dimensions based on the levels of hierarchy. For example, if geography has five levels of hierarchy like teritary, region, country, state and city; constellation schema would have five dimensions instead of one.