Posts

Oracle Constraints

Oracle constraints are means in the process of defining some conditions about the database that must remain true while inputting/modifying/deleting data in the database. The basic structure of an Oracle constraint is defined as: The CONSTRAINT keyword is followed by a unique constraint name and then the constraint definition. The constraint name is used to manipulate the constraint once the table has been created. In Oracle, constraints can be defined at the column or table level. An example of defining constraints at table level may be: CREATE TABLE STUDENT ( STUDENT _ID NUMBER(3) CONSTRAINT S_ID CHECK (STUDENT _ID > 0), STUDENT _NAME CHAR(30) CONSTRAINT S_NAME NOT NULL, MARKS_COUNT NUMBER(6), CONSTRAINT STUDENT _PRIME PRIMARY KEY (STUDENT _ID)) Column level constraints go directly after the column definition to which they refer and the table level constraints go after the last column definition. CREATE TABLE CLASS ( ROOM NUMBER(10) CONSTRAINT ID CHECK (ID BET

Abstract Datatype

Abstract datatype are datatypes that consists of one or more subtypes. This datatype is used to describe the data accurately. Abstract datatypes can be nested and can contain references to other abstract datatype. This datatype can be reused. Abstract datatype is object oriented thing. Creating abstract datatype CREATE TYPE STUDENT_NAME_TY AS OBJECT (FIRST_NAME VARCHAR2(15), LAST_NAME VARCHAR2(15)); In above example AS OBJECT identify STUDENT_NAME_TY as an object implementation.  Using abstract datatype in table CREATE TABLE STUDENT (STUDENT_ID NUMBER(4) PRIMARY KEY, NAME STUDENT_NAME_TY); Viewing details of table DESC STUDENT; or we can use the following SELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLUMNS WHERE TABLE_NAME='STUDENT'; or we can use the following SELECT ATTR_NAME, LENGTH, ATTR_TYPE_NAME FROM USER_TYPE_ATTRS WHERE TYPE_NAME='STUDENT_NAME_TY'; Inserting data in table INSERT INTO STUDENT VALUES

SQL Server 2012 is Available for Download

As the foundation of the cloud-ready information platform, SQL Server 2012 will help organizations unlock breakthrough insights across the organization as well quickly build solutions and extend data across on-premises and public cloud backed by mission critical confidence. SQL Server 2012 capabilities and highlights are as follows:- Greater availability Deliver the required 9s and data protection with AlwaysOn, delivering added functionality that allows customers to experience even more of the flexibility and value. Breakthrough insight Unlock new insights with rapid data exploration across the organization with Power View, available to customers for the first time. Credible, consistent data Provide a consistent view across heterogeneous data sources with the BI Semantic Model (BISM) a single model for Business Intelligence applications. Make data quality apart of everyday life with the Master Data Services add-in for Excel and new Data Quality Services

Introducing Microsoft SQL Server 2012 (Free ebook)

If you are a SQL Server guy and want to explore Microsoft SQL Server 2012 then a good new waiting for you. Microsoft has just finished and provided free ebook: Introducing Microsoft SQL Server 2012. Get it Now Introducing Microsoft SQL Server 2012 includes 10 chapters:- PART I   DATABASE ADMINISTRATION (by Ross Mistry) 1.   SQL Server 2012 Editions and Engine Enhancements 2.   High-Availability and Disaster-Recovery Enhancements 3.   Performance and Scalability 4.   Security Enhancements 5.   Programmability and Beyond-Relational Enhancements PART II   BUSINESS INTELLIGENCE DEVELOPMENT (by Stacia Misner) 6.   Integration Services 7.   Data Quality Services 8.   Master Data Services 9.   Analysis Services and PowerPivot 10.   Reporting Services Get it Now

Time Format in SQL

Image
Today I received a question from a guy on SQL title, I'm not a SQL guy, but when I dive to solve this, done. Look at the question:- { SELECT LEFT(CONVERT(VARCHAR, online_time,109),4)+' '+ right(convert(varchar, online_time,109),2) as online_time from time above is my query i want output as 04:30 am  4:30 am will do(if initial 0 is removed no prob) 09:45 pm 11:15 am my prob is that above query is giving right output for time before 10 am/pm but after 9:59 am/pm time is wrong i.e, it displays 11:3 pm instead of 11:30 pm and give right for 4:40 pm how i can do that } Now, look at my solution:- SELECT SUBSTRING(CONVERT(CHAR(26), GETDATE(), 9), 12, 6) GO --OUTPUT = 11:30 and if you want to add AM or PM then SELECT SUBSTRING(CONVERT(CHAR(26), GETDATE(), 9), 12, 6) + ' ' + SUBSTRING(CONVERT(CHAR(26), GETDATE(), 9), 25, 2) COLNAME GO --OUTPUT = 11:30 AM Please Note: At the place of ' '

A network-related or instance-specific error occurred while establishing a connection to SQL Server

Image
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) In this post I am going to show you the way to overcome this issue. Just follow the quick steps: (i) Open SQL Server Configuration Manager (ii) Start the selected services as given in image below. In most cases these steps will fix your issue. Thanks.

Time Out to Connect SQL Server Issue

When performing tasks involving a large amount of data in Ultimate Survey Enterprise survey software via your web browser, an error is thrown that looks similar to the following: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  Exception Details: System.Data.OleDb.OleDbException: Timeout expired Solution: 1. Open SQL Server Enterprise Manager and find the server that contains your Ultimate Survey Enterprise survey software database. 2. Right click on the server name. 3. Select properties. 4. Choose the Connections tab. 5. Increase the query timeout value. The value is in seconds. Set it to 0 for unlimited time 6. Click OK.

Database 'compuzitdb1' cannot be opened due to inaccessible files or insufficient memory or disk space

Today in the morning when I tried to access my one of the website it displayed titled error. I got socked that why this error coming up. The reason was my Database Host Provider where changed the server and he missed something to activate for my database and this causes the error "Database 'compuzitdb1' cannot be opened due to inaccessible files or insufficient memory or disk space" . When I contacted to DB experts they told me to be relax because it is a normal DB error and can be fixed by trying the following checks. 1) If possible add more hard drive space either by removing of unnecessary files from hard drive or add new hard drive with larger size. 2) Check if the database is set to Autogrow on. 3) Check if the account which is trying to access the database has enough permission to perform operation. 4) Make sure that .mdf and .ldf file are not marked as read only on operating system file system level. I hope this post will help you t

Database Not Available Error in Oracle

To fix this error: (i) Click on Start > Run > Type 'cmd' and press enter (ii) Now type 'svrmgrl' and press enter (iii) Type 'connect' and press enter (iv) Type Username 'internal' and password 'oracle' and press enter (v) Type 'startup' and press enter (vi) Now it will take about 1min to process and finally click 'edit' to close cmd Now start PLSQL, you error is fixed.

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System