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 |
|
barefoot
Starting Member
2 Posts |
Posted - 2006-02-15 : 04:08:12
|
| Hi,I have a query to built that selects or deletes the record if the storage column does not hold the text data in this format ??-???-? (eg. FA-999-L). Any idea of how to select the data like dat? Any SQL syntax that governs such function?Thanks. |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-02-15 : 04:18:01
|
Somthing like this?SELECT *-- DELETE DFROM MyTable AS DWHERE MyColumn NOT LIKE '__-___-_' The SELECT will show you which rows are going to be delete, remove that and enable the DELETE when you are ready to delete themThe '_' character will match any single character. If the code you need must be Alpha-Alpha-HYPHEN-Digit-Digit-Digit-HYPHEN-Alpha, specifically, then you could make a more robust test withWHERE MyColumn NOT LIKE '[A-Z][A-Z]-[0-9][0-9][0-9]-[A-Z]'Kristen |
 |
|
|
barefoot
Starting Member
2 Posts |
Posted - 2006-02-20 : 04:23:48
|
| Thanks Kristen. It really works. Really appreciate the help. Gonna continue developing the rest of the DTS after this. :) |
 |
|
|
|
|
|