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 |
|
daisy
Starting Member
13 Posts |
Posted - 2005-05-17 : 11:29:33
|
| i need to look up a job_id with an idthat is actually being used with anotherelement separated by a dash. e.g. 6080-1how can i call only the first part, 6080? |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-05-17 : 11:58:26
|
| try wildcards like '6080%' |
 |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-05-17 : 11:58:28
|
LEFT(ColumnName,4)ORSUBSTRING(ColumnName,1,CHARINDEX('-',ColumnName,1)-1)AndyBeauty is in the eyes of the beerholder |
 |
|
|
nosepicker
Constraint Violating Yak Guru
366 Posts |
Posted - 2005-05-17 : 12:00:05
|
| Assuming that your id's will have at most one dash in them:select left([id], charindex('-', [id]) -1) |
 |
|
|
|
|
|