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.

 All Forums
 Development Tools
 ASP.NET
 splitting the LocationID field

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2007-03-23 : 08:05:20
I have the field LocationID (string)which has values like

"AZ001","AZ002","IN002","IN004" first 2 will be always alphabets and remaining 3 will be numbers,

I want to split it like "AZ" ," 001"

"AZ","002"

"IN" "002"

"IN" "004"

now i will populate dropdownlist with unique values of "AZ" "IN"

according to first dropdownlist how i will populate second dropdownlist?

So how to write sql query for splitting? and then populating the dropdownlist ?








SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-23 : 08:17:19
SELECT DISTINCT LEFT(LocationID, 2)
FROM Table1


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -