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 |
seven_of_nine
Starting Member
6 Posts |
Posted - 2007-02-01 : 15:41:51
|
HelloI'm hoping some-one can help. I'm new to MS SQL.In the SQL language I currently code in, we have a string comparison operator called CO or contains only ie it will allow us to return a pattern that only contains a certain character (Contains Only: True, if operand1 only contains characters from operand2). I have a field which can contain alphanumeric characters, but I want to select fields that ONLY contain zeroes - so to use wildcards is not feasible as I'm not interested in a field that looks like this '1023000' or like this '1023AB000X' or any other variation that can contain one or more zeroes together with other alphanumeric characters. I don't know the length either, as it can vary so I can have '0' or '0000000'. Can any-one assist me with this?Thanks |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-02-01 : 16:11:47
|
where fld not like '%[^0]%'where patindex('%[^0]%',fld) = 0==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|