I have a slow executable query, and I was hoping that someone with a little more knowledge in sql would be able to help me improve performance:
I have 2 source and general tables, I upload some data containing the date, time and row (whch is the server name), as well as some ..
The source table may contain 40k + rows (has 30 odd columns, a combination of indexes, dates, times and some varchars (255) / (Max)
I use the following query to delete any data from Common that resides in the source:
'Delete from Common where convert(varchar(max),Date,102)+convert(varchar(max),Time,108)+[ServerName] in (Select convert(varchar(max),[date],102)+convert(varchar(max),time,108)+ServerName from Source where sc_status < 300)'
The source fields are in this format:
- ServerName varchar (255) IE SN1234
- Date varchar (255) IE 2012-05-22
- Varchar time (255) IE 08:12:21
Common fields are in this format:
- ServerName varchar (255) IE SN1234
- Date date IE 2011-08-10
- Time (7) IE 14: 25: 34.0000000
thanks
source share