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 |
|
john20
Starting Member
30 Posts |
Posted - 2008-04-17 : 05:25:23
|
| Hi All,I want to retrive record from the table using select statement, which dosent contain "-" in the column value.means i have record with "-" and without "-"like-1223-456789i want to retrive only 236789can u tell me how can i do that..Thanks in advance.Regards,-John |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2008-04-17 : 05:42:19
|
| Two options:SELECT ColumnName FROM table WHERE ColumnName > 0orSELECT ColumnName FROM table WHERE SUBSTRING(ColumnName, 1, 1) <> '-'--Lumbago |
 |
|
|
kfluffie
Posting Yak Master
103 Posts |
Posted - 2008-04-17 : 06:12:12
|
quote: Originally posted by Lumbago Two options:SELECT ColumnName FROM table WHERE ColumnName > 0orSELECT ColumnName FROM table WHERE SUBSTRING(ColumnName, 1, 1) <> '-'--Lumbago
It should be => before the 0 because you want to retrieve the 0 also, otherwise it will only retrive 1 and up. SELECT ColumnName FROM table WHERE ColumnName => 0 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-18 : 04:28:21
|
quote: Originally posted by john20 Hi All,I want to retrive record from the table using select statement, which dosent contain "-" in the column value.means i have record with "-" and without "-"like-1223-456789i want to retrive only 236789can u tell me how can i do that..Thanks in advance.Regards,-John
Are you using INT datatype to store data?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|