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

Friday, July 24, 2020

SQL Query to find all tables in a Database containing specified column name

Following query will help to find field name available in any of the table in a database.

SELECT * from INFORMATION_SCHEMA.COLUMNS 
where COLUMN_NAME like '%ColumnName%' 
order by TABLE_NAME



SQL Server:

SELECT Table_Name, Column_Name 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'YOUR_DATABASE'
AND COLUMN_NAME LIKE '%YOUR_COLUMN%'


Oracle:

SELECT owner, table_name, column_name 
FROM all_tab_columns 
WHERE column_name LIKE '%YOUR_COLUMN_NAME%'

AND OWNER IN ('YOUR_SCHEMA_NAME');

Thursday, December 5, 2019

Get Table Name with Row Count from SQL Database

Select the database you want to filter the information about the row count and run following SQL Statement

SELECT 
    T.NAME AS 'TABLE NAME',
    P.[ROWS] AS 'ROW COUNT'
FROM SYS.TABLES T 
INNER JOIN  SYS.PARTITIONS P ON T.OBJECT_ID=P.OBJECT_ID

This help me to know how many rows are there in table. Hope this will help you too.

Wednesday, April 6, 2016

How to Test a Database Connection String using NotePad

Create and Configure a Universal Data Link (.udl) File with Notepad.

I just came across a way to test a data provider’s connection string (like a SQL Server database) with the help of a plain text file using Notepad.  To investigate and test out if your connection string works, you’re going to want to create a UDL file. 

To do this, follow these steps:
1.Open up Notepad and create an empty text file, then click File -> click Save -> and save it with the File name: TestConnection.udl to your desktop.
2.Go to your desktop and double-click on the TestConnection.udl file you just created and the Data Link Properties box will popup.
3.Select the Provider tab and Find the provider that you want to connect with and click Next >>
4.Now from the Connection tab, select or enter your source/ server name  then enter information to log on to server -> and select the database on the server. 
5.Click Test Connection and click OK to save the file.

Note: If errors occur during testing of your connection string, you will get a popup box with the error message.

Once, you've successfully tested your connection string, now go and compare the details of your TestConnection.udl with your (website) project connection string to see if they are similar.



Thursday, August 13, 2015

Difference between SQL and NOSQL Databases.

SQL databases are like automatic transmission and NoSQL databases are like manual transmission. Once you switch to NoSQL, you become responsible for a lot of work that the system takes care of automatically in a relational database system. Similar to what happens when you pick manual over automatic transmission. Secondly, NoSQL allows you to eke more performance out of the system by eliminating a lot of integrity checks done by relational databases from the database tier. Again, this is similar to how you can get more performance out of your car by driving a manual transmission versus an automatic transmission vehicle.

However the most notable similarity is that just like most of us can’t really take advantage of the benefits of a manual transmission vehicle because the majority of our driving is sitting in traffic on the way to and from work, there is a similar harsh reality in that most sites aren’t at Google or Facebook’s scale and thus have no need for a Bigtable or Cassandra.

These are some points which gives us some difference between SQL and NOSQL Databases.


  • SQL databases are primarily called as Relational Databases (RDBMS); whereas NoSQL database are primarily called as non-relational or distributed database.
  • SQL databases have predefined schema whereas NoSQL databases have dynamic schema for unstructured data.
  • SQL databases are vertically scalable whereas the NoSQL databases are horizontally scalable. SQL databases are scaled by increasing the horse-power of the hardware.
  • In case of scalability: In most typical situations, SQL databases are vertically scalable. You can manage increasing load by increasing the CPU, RAM, SSD, etc, on a single server. On the other hand, NoSQL databases are horizontally scalable. You can just add few more servers easily in your NoSQL database infrastructure to handle the large traffic.
  • For complex queries: SQL databases are good fit for the complex query intensive environment whereas NoSQL databases are not good fit for complex queries. On a high-level, NoSQL don’t have standard interfaces to perform complex queries, and the queries themselves in NoSQL are not as powerful as SQL query language.

Reference from : link