Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Friday, April 20, 2012

How to get the version of Oracle database using query?

Its very easy to get the version of Oracle database using a query. It works in most of the Oracle version.

We can execute the following query just as like any other queries and get the result.


SELECT * FROM v$version WHERE banner LIKE 'Oracle%';

Once you execute this query you will get a result set like this,




Hope this is useful!

Monday, August 4, 2008

Search column name in SQL DB

This query returns the complete details of a searched column in the entire database

SELECT table_name = sysobjects.name,
column_name = syscolumns.name,
datatype = systypes.name,
length = syscolumns.length
FROM sysobjects
JOIN syscolumns ON sysobjects.id = syscolumns.id
JOIN systypes ON syscolumns.xtype = systypes.xtype
WHERE sysobjects.xtype='U' and syscolumns.name like '%ColumnName%'
ORDER BY sysobjects.name, syscolumns.colid

Might be simple.. But useful at times..!!