Latest Posts
Showing posts sorted by relevance for query sql dates. Sort by date Show all posts
Showing posts sorted by relevance for query sql dates. Sort by date Show all posts
Sunday, June 19, 2016
Let's say you want to know the orders that takes place in the Northwind database table Orders tables that occurs during the Christmas Eve 1997-12-24 and the New Years Day the following year in 1998-01-01.
Here is the SQL to query the OrderID between those date range:
SELECT OrderID, OrderDate FROM Orders WHERE OrderDate BETWEEN '1997-12-24' AND '1998-01-01'
Retrieve records with NULL value in the ShippedDate column in the Orders table in Northwind
Retrieve records that is does not have NULL value in the ShippedDate column in the Orders table in Northwind
SELECT OrderID, ShippedDate FROM Orders WHERE ShippedDate IS NULL
Retrieve records that is does not have NULL value in the ShippedDate column in the Orders table in Northwind
SELECT OrderID, ShippedDate FROM Orders WHERE ShippedDate IS NOT NULL
Monday, March 9, 2015
Transaction processing is a concept in SQL that allows you to execute a query or rollback the changes if something goes wrong. A way of enforcing the data integrity of the database. As such, you can only rollback INSERT, UPDATE, and DELETE. Not that there's any use in rolling back a SELECT statement because there's no change in data.
The following is how you would wrap a transaction around a DELETE statement:
(1 row(s) affected)
If you are dealing with multiple statements then you can use the SAVE TRANSACTION, SAVE TRANSACTION allows you to create a placeholder so that you can rollback a transaction at a checkpoint.
The following is how you would wrap a transaction around a DELETE statement:
BEGIN TRANSACTION DELETE Products WHERE ProductID = 87 COMMIT TRANSACTIONThe above query will only execute if there are no errors, if there's an error the transaction will be rolled back. That's it, that's the whole concept of what a transaction is, if there are no errors then you should get the following message.
(1 row(s) affected)
If you are dealing with multiple statements then you can use the SAVE TRANSACTION, SAVE TRANSACTION allows you to create a placeholder so that you can rollback a transaction at a checkpoint.
Wednesday, September 4, 2013
Oracle dates have a different format than SQL Server dates. So to select a date for the Oracle database you have to have the date in the following format.
Next: C# Querying From An Oracle Database
string myDate = "10/9/2012 2:55:25 PM";
string sql = "SELET * FROM SomeTable WHERE SomeDateField=" +
"to_date('" + myDate + "','" + "MM/DD/YYYY HH:MI:SS " +
myDate.Substring(myDate.Length - 2) + "');";
Next: C# Querying From An Oracle Database
Subscribe to:
Posts (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu