Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sql-programmers
Posting Yak Master
190 Posts |
Posted - 2013-12-25 : 23:40:54
|
For examble:In a table name like1.Test2.Test.3.Test..4.Test...How will get the name "Test" using distinct keyword?SQL Server Programmers and Consultantshttp://www.sql-programmers.com/ |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-12-26 : 03:14:30
|
[code]SELECT DISTINCT Column FROM table[/code]Where column is the column containing Test as value------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-12-26 : 03:58:08
|
In case what you've is the full value within the column as shown above, what you need is thisSELECT DISTINCT STUFF(Column,1,CHARINDEX('.',Column),'') FROM table ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|