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 |
|
durilai
Starting Member
13 Posts |
Posted - 2006-06-09 : 18:15:18
|
| I have a field that contains a id number that id formatted similar to this:K12345 or I12345 I want to pull only the ones with an 'I' as the left character. I have been trying:...AND (LEFT(field, 1) = 'I')......AND (LEFT(field, 1) = N'I')......AND (LEFT(field, 1) = I')...Any help, I am going crazy. Thanks in advance! |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-06-09 : 18:19:00
|
| What is the problem you are having?CODO ERGO SUM |
 |
|
|
durilai
Starting Member
13 Posts |
Posted - 2006-06-09 : 18:34:34
|
| Sorry, It is not pulling any records. I am positive there are some. I am just wanting to verify that I am using the correct syntax, because this is my first time doing this in a query. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-06-09 : 18:48:04
|
| What is the datatype/length of the column?Have you verified that there are no leading spaces in the column?You might try this:where left(ltrim(field),1) = 'I'CODO ERGO SUM |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-10 : 03:30:37
|
| or useWhere field like 'I%'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|