×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: SQL
Posted by: Trần Hải Quân
Added: Jun 28, 2013 7:27 AM
Modified: Jun 28, 2013 10:27 AM
Views: 23
Tags: sql
  1.        
  2. UPDATE dbo.tblContentProperty
  3. SET
  4.         LongString=REPLACE(LongString,'ImageText','Header')
  5. WHERE
  6.         pkID IN
  7. (
  8. SELECT  
  9.                 pro.pkID
  10. FROM    dbo.tblContentProperty pro
  11.         INNER JOIN tblPage p ON pro.fkContentID = p.pkID
  12.         INNER JOIN tblWorkPage wp ON wp.fkPageID=p.pkID
  13.         INNER JOIN dbo.tblPageType pt ON p.fkPageTypeID=pt.pkID
  14.         INNER JOIN tblPageDefinition pd ON pro.fkPropertyDefinitionID = pd.pkID
  15.         INNER JOIN tblPageDefinitionType pdt ON pd.fkPageDefinitionTypeID = pdt.pkID
  16.         INNER JOIN dbo.tblWorkContentProperty wcp ON wcp.fkWorkContentID=wp.pkID
  17. WHERE
  18.     pt.Name ='ShopImage'-- <-- page type name  
  19.     AND pd.Name='ImageList'
  20. )
  21.    
  22.    
  23. UPDATE  dbo.tblWorkContentProperty
  24. SET     LongString = REPLACE(LongString, 'ImageText', 'Header')
  25. WHERE   pkID IN ( SELECT    wcp.pkID
  26.                   FROM      dbo.tblContentProperty pro
  27.                             INNER JOIN tblPage p ON pro.fkContentID = p.pkID
  28.                             INNER JOIN tblWorkPage wp ON wp.fkPageID = p.pkID
  29.                             INNER JOIN dbo.tblPageType pt ON p.fkPageTypeID = pt.pkID
  30.                             INNER JOIN tblPageDefinition pd ON pro.fkPropertyDefinitionID = pd.pkID
  31.                             INNER JOIN tblPageDefinitionType pdt ON pd.fkPageDefinitionTypeID = pdt.pkID
  32.                             INNER JOIN dbo.tblWorkContentProperty wcp ON wp.pkID=wcp.fkWorkContentID
  33.                   WHERE     pt.Name = 'ShopImage'-- <-- page type name 
  34.                             AND pd.Name = 'ImageList' )