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

Thursday, April 16, 2009

Finding duplicates with SQL?

Suppose Col1 is the field name for which you want to find duplicates:

Select Col1, Count(Col1) as count
from table1
group by Col1
having Count(Col1) > 1

.

Rounding a number to 2 decimal places in SQL

Use T-SQL Convert Function.

Select convert ( decimal(8,2) , 9.4125 )

Output: 9.41

Wednesday, September 24, 2008

Difference between Varchar and Char data types?

Varchar is a variable length character data type whereas Char is a fixed length character data type. Because Varchar is a variable length data type therefore its size is the actual length of the data entered and not the maximum size of the column