Skip to main content

Posts

Showing posts from 2014

WCF - Error : Meta Data not accessible in the WCF(web service)

While working with the service, we often face the error : "meta data not accessible in the web service or Failure to invoke the service due meta data inaccessiblity" . Add the below code in web.config : <services>    <service name="SyncFalconService.SyncFalcon" behaviorConfiguration="metadataBehavior">     <endpoint address="" binding="wsHttpBinding" contract="SyncFalconService.ISyncFalcon"/>     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>      </service>   </services>

SQL - Identify and kill a process/query that is running for a long time

SELECT  sqltext. TEXT , req.session_id , req.status , req.command , req.cpu_time , req.total_elapsed_time FROM  sys.dm_exec_requests req CROSS  APPLY sys.dm_exec_sql_text ( sql_handle )  AS  sqltext   While running above query if you find any query which is running for long time it can be killed using following command. KILL  [session_id]  

SQL - Remove the duplicate rows from the table.

CREATE TABLE TBLTEST(ID INT,FIRSTNAME VARCHAR(20),LASTNAME VARCHAR(20)) INSERT INTO TBLTEST VALUES(1,'VANNI','RAJ') INSERT INTO TBLTEST VALUES(1,'VANNI','RAJ') INSERT INTO TBLTEST VALUES(2,'TEST','TEST') ;WITH CTE AS( SELECT  ID,FIRSTNAME,LASTNAME,  ROW_NUMBER() OVER(ORDER BY FIRSTNAME,LASTNAME) ROW_NUM,  RANK() OVER(ORDER BY FIRSTNAME,LASTNAME) RNK FROM  TBLTEST) DELETE FROM CTE WHERE ROW_NUM <> RNK; SELECT * fROM TBLTEST DROP TABLE  TBLTEST