Showing posts with label Oracle vs SQL Server. Show all posts
Showing posts with label Oracle vs SQL Server. Show all posts

Tuesday, July 22, 2014

Get Current Date In Oracle and Server SQL

To get the current system date, we use sysdate in Oracle and getdate() in SQL Server, respectively.

Using Oracle sqlplus.

SQL> select sysdate from dual;

SYSDATE
-------------------
07-22-2014 07:21:21
Using SQL Sever Management Studio.
select getdate()
2014-07-22 11:23:23.097

Sunday, August 26, 2012

Create new tables in Oracle and SQL Server


In Oracle, we can use  "create table as select" as shown below.
1. Copy table into a new table.
create table tbl_x as select * from tbl_test;
2.Create a  new empty table with the same structure.
create table tbl_y as select * from tbl_test where 2=1;

In SQL Server,  we can use select into as shown below.
1. Copy table into a new table.
select * into  tbl_x   from  tbl_test ;
2. Create a  new empty table with the same structure.
select * into  tbl_y   from tbl_test  where 2=1;