Monday, June 10, 2013

how to get different rows from tableA with compare of tableB sql server


Using the new EXCEPT operator we can find out which rows in tableA do not exist in tableB.
It will only work with 2005 or latter version of SQL Server 2005.


create table tableX



(
 
column1 int,

column2 int



)
 
insert into tableX

select 1,1

union all

select 1,2

union all

select 1,3

union all

select 2,1

create table tableY



(
 
column1 int,

column2 int



)
 
insert into tableY

select 1,1

union all

select 1,3

union all

select 2,2



go
 
select *

from tableX



EXCEPT
 
select *

from tableY

The above statement is equals to following statement

select column1, column2
from   tableX
where not exists (select  *
                             from     tableY
                             where   tableX.column1 = tableY.column1
                                 and   tableX.column2 = tableY.column2)


Thanks
Mahesh kumar sharma

Thursday, June 6, 2013

IDENT_CURRENT vs TOP 1

How to get last inserted id in table

SELECT IDENT_CURRENT('clients')

select top 1 clientid from Clients order by 1 desc

Tuesday, June 4, 2013

Attaching the Script debugger to process 'iexplore.exe' on machine '' failed. A debugger is already attached on IE10 VS2010

I just upgraded my IE with IE10 and VS2010 start giving error
---------------------------
Microsoft Visual Studio
---------------------------
Attaching the Script debugger to process '[9999] iexplore.exe' on machine 'MACHINE-PC' failed. A debugger is already attached.
---------------------------
OK  
---------------------------

For this we have simple solution
Run Command prompt with admin mode and paste following command if you have 64 bit machine
otherwise just change the programFiles.


regsvr32.exe "%ProgramFiles(x86)%\Common Files\Microsoft Shared\VS7Debug\msdbg2.dll

Thanks
Mahesh