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 |
Naumaan
Starting Member
2 Posts |
Posted - 2006-09-28 : 13:53:23
|
I have used Left function in where clause and it slow down data fetching extremely.But if i did not use left function then same query fetch data in few seconds. Can anybody helps me in this matter. eg where (left(AccountNumber,4) = @Accountnumber). |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-09-28 : 13:59:27
|
Because it can't use the index as it needs to perform an operation on all the columns.trywhere AccountNumber like @Accountnumber + '%'if @Accountnumber is 4 characters.==========================================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. |
 |
|
Naumaan
Starting Member
2 Posts |
Posted - 2006-09-28 : 15:13:00
|
Thanks for the help, I have another question . if i join tables likeleft join ( select left(AccountNumber,4) AccNum,.......................................... )c on left(a.AccountNumber,4) = c.AccNum then can i use like insted of left while joining tables. if yes then plz give me some example. |
 |
|
pootle_flump
1064 Posts |
Posted - 2006-09-29 : 04:03:24
|
Yes you can - and it is the same syntax as the WHERE clause. |
 |
|
|
|
|