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 |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-07-30 : 06:09:52
|
This isssue is to do with the fact that three fields i.e. field1, field2, field3 in a table table2 are of type nvarchar(200)When these three fields are used in a joined select query (see below) then the query takes a long time.select table2.field1 + ' ' + table2.field2, table2.field3, table1.field1, table1.field2, ...from table1 left join table2 on table1.fieldID = table2.fieldID ... ...Question:As I have carried out several tests, I see that the nvarchar fields are causing the slow speed.The nvarchar fields are not indexed.How should I solve this problem please? |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-07-30 : 07:17:39
|
Solved by using a table variable and placing the table result with varchar fields into it.Then this table variable is used in a further join in the query.This has speeded up th eperformance.Tahnks anyway. |
 |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2010-07-30 : 07:20:36
|
The problem is not the nvarchar status. It's that they are not indexed. RE-create the tables as varchar and not indexed and you should see that the core problem remains. |
 |
|
|
|
|