| Author |
Topic |
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-03-06 : 19:43:38
|
| I am trying to import data from Access into SQL 2000 and want to get everything except for a field that starts with WAS...Is it something like NOT like 'WAS%'SELECT [LOC], [BU], [DIV], [KEY0], .....[TYPE] FROM [TESIS2] WHERE TYPE='CELL' or TYPTE='CELL' and [key0] NOT LIKE 'WAS%'thanks for the help |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-03-06 : 19:56:30
|
| Yes. Are you getting errors running the query?Tara Kizer |
 |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-03-06 : 20:57:32
|
| No errors, it just allows 'WAS 555-5555' and numbers like that to come through. I dont want to let any numbers that start with 'WAS ' to be saved into the database.so I am getting all fields when I only want a select few. I was thinking that it might be that I am bringing it from access to SQL could this be the problem????Thank YouSELECT [LOC], .....[TYPE] FROM [TESIS2] WHERE TYPE='CELL' or TYPE='CELL' and [key0] NOT LIKE 'WAS%' |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-06 : 21:00:06
|
[code]SELECT [LOC], [BU], [DIV], [KEY0], .....[TYPE] FROM [TESIS2] WHERE (TYPE='CELL' or TYPTE='CELL')and [key0] NOT LIKE 'WAS%'[/code] KH |
 |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-03-07 : 00:04:36
|
| ah yes, thank you. It was something that I was missing. thanks for the help |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-07 : 01:12:17
|
| It's called Operator Precedense.Peter LarssonHelsingborg, Sweden |
 |
|
|
nhaas
Yak Posting Veteran
90 Posts |
Posted - 2007-03-09 : 01:13:39
|
so the operator precedense is in the brackets (). Thanksquote: Originally posted by Peso It's called Operator Precedense.Peter LarssonHelsingborg, Sweden
|
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-09 : 01:19:10
|
| Operator precedence will decide which operator will be evaluated first in a series of operators in the expression. In SQL, AND has higher precedence than OR.To avoid this, we place OR expression inside parenthesis, so the expression will be evaluated before AND operator.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-09 : 01:26:14
|
rule of thumb. Always use parenthesis () to define the operator evaluation priority. Don't rely on the default. Different language might have different operator precedence. KH |
 |
|
|
|