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 |
Jake_UK
Starting Member
7 Posts |
Posted - 2011-10-13 : 05:14:14
|
I have the following SQL, which runs fine over one version of the same DB, but locks up my PC when running over another version (newer data) of the same db;drop table tmpRunnergoselect distinct [Runner id] as runner_id, runner, ( select top 1 Selection_ID from PriceData b where substring(replace(a.Runner,'''',''),1,12) = substring(b.Selection_name,1,12) ) as bfselection_idinto tmpRunnerfrom DataCapture awhere not exists ( select runner_id from Runner b where cast(a.[runner id] as int) = b.runner_id )goBasically I am trying to retrieve a numerical ID field using a character name field, stripping out any ' characters. None of the tables are very large 100,000 rows or less.The only way I have been able to stop what seems like a loop is to remove power from my pc, far from ideal.I am at a loss as to why this would cause my pc to totally stop responding to any mouse click or key press?(I wanted to avoid permanently removing the quotes from the name field(s) ).Any suggestions would be most welcome.tiaps. Just noticed in preview that my neatly indented script has lost the indentation, apologies. |
|
Jake_UK
Starting Member
7 Posts |
Posted - 2011-10-13 : 05:32:07
|
OK, I think the problem might be to do with a collation conflict between the columns in the two tables I am using.Quite why it should freeze up the pc, I am not sure. |
 |
|
|
|
|
|
|